Suspicious Execution with NodeJS
This rule detects suspicious Node.js execution patterns on Windows systems, including user-writable runtimes, preload arguments, and inline eval, decode, or child-process usage, indicating potential malicious activity.
This detection identifies suspicious Node.js execution patterns on Windows systems. Attackers may leverage Node.js, especially if it’s running from user-writable locations, to execute malicious code. The rule focuses on identifying instances where Node.js is executed from unusual paths like AppData, uses preload arguments (-r) potentially to inject malicious modules, or uses inline JavaScript execution techniques like eval, atob, or child_process to spawn other processes. The rule is designed to work with multiple data sources, including Elastic Defend, CrowdStrike, Microsoft Defender XDR, SentinelOne, Sysmon, and Windows Security Event Logs. This is important for defenders as malicious Node.js execution can lead to code injection, privilege escalation, and ultimately, system compromise.
Attack Chain
- A user downloads or receives a malicious Node.js script, often disguised as a legitimate file.
- The script is saved to a user-writable directory such as the user’s AppData folder.
- The attacker executes
node.exefrom the AppData directory, specifying the malicious script as an argument. - Alternatively, PowerShell is used to launch Node.js with the
-rargument to preload a malicious module, bypassing standard execution controls. - The Node.js script uses the
eval()oratob()functions to execute obfuscated code. - The script leverages the
child_processmodule to spawn a new process, such ascmd.exeorpowershell.exe. - The spawned process executes malicious commands, potentially downloading additional payloads or establishing a reverse shell.
- The attacker gains unauthorized access to the system and performs malicious activities, such as data exfiltration or lateral movement.
Impact
A successful attack could lead to a complete compromise of the affected system. This includes the potential for data theft, installation of backdoors, and further propagation of the attack to other systems on the network. While the number of victims is not specified, the broad applicability of Node.js makes this a significant threat across various sectors.
Recommendation
- Deploy the “Suspicious Execution with NodeJS” Sigma rule to your SIEM to detect the execution patterns described in this brief, tuning it for your specific environment.
- Monitor process creation events for
node.exeexecuting from user-writable paths like\Users\*\AppData\*, as highlighted in the Sigma rule and attack chain. - Investigate any instances of
node.exebeing launched with the-rargument bypowershell.exe, as this indicates a potential module preload attack, which is covered in the Sigma rule. - Review command-line arguments for
node.execontainingeval(,atob(, orrequire*child_process*to identify potential inline code execution and child process spawning, as per the Sigma rule description.
Detection coverage 3
Node.js Executed from User AppData
highDetects Node.js being executed from user-writable AppData directories, which can indicate malicious activity.
Node.js PowerShell Preload Argument
highDetects Node.js being executed with the -r argument by PowerShell, indicating a potential module preload attack.
Node.js Inline Code Execution
highDetects Node.js command lines containing eval, atob, or require*child_process*, indicating potential inline code execution.
Detection queries are kept inside the platform. Get full rules →