Suspicious Windows Command Shell Arguments Detection
This rule identifies the execution of the Windows Command Shell process (cmd.exe) with suspicious argument values, often observed during malware installation.
This detection identifies suspicious uses of the Windows Command Shell (cmd.exe), a common technique employed by malware and attackers. The rule focuses on identifying cmd.exe processes launched with specific argument patterns known to be associated with malicious activities such as downloading and executing payloads, bypassing security controls, or obfuscating commands. This rule helps defenders identify potential malware infections or suspicious behavior that may indicate an active attack. The rule leverages a broad range of data sources including Windows Security Event Logs, Sysmon, SentinelOne, Microsoft Defender XDR, Elastic Endgame, and Crowdstrike to improve detection coverage and fidelity. By focusing on suspicious command-line arguments and parent-child process relationships, it aims to reduce false positives while maintaining a high level of detection efficacy.
Attack Chain
- An attacker gains initial access via an exploit or social engineering.
- The attacker uses cmd.exe to execute a command containing suspicious arguments, such as those used for downloading files (e.g.,
curl,Invoke-WebRequest) or bypassing security restrictions (e.g.,ActiveXObject). - Cmd.exe may be used to echo commands to a file and then execute the file with wscript.exe or mshta.exe
- Cmd.exe might invoke explorer.exe with command line arguments to browse to a malicious network share using WebDav (
DavWWWRoot). - Cmd.exe executes commands to disable security features or modify system configurations.
- Cmd.exe uses
copy /bto concatenate files from a network location to evade detection. - Cmd.exe executes a script or binary downloaded in the previous steps.
- The final objective can vary, but often includes lateral movement, data exfiltration, or deployment of ransomware.
Impact
Successful exploitation can lead to arbitrary code execution, allowing attackers to compromise systems, steal sensitive data, or disrupt operations. This is a common early-stage technique, so early detection is crucial to prevent further damage. Undetected malicious command shell usage can lead to widespread infection and significant financial and reputational damage.
Recommendation
- Deploy the Sigma rule
Suspicious Cmd.exe Activity with Encoded or Obfuscated Argumentsto your SIEM and tune for your environment. - Enable Sysmon process creation logging to capture the command-line arguments used by cmd.exe.
- Investigate any alerts generated by this rule, focusing on the parent process, command-line arguments, and network connections.
- Deploy the Sigma rule
Cmd.exe with Suspicious Parent Processto detect unusual parent-child relationships involving cmd.exe. - Review and harden endpoint security policies to restrict the execution of cmd.exe in non-standard locations.
- Monitor network traffic for connections originating from cmd.exe to external or suspicious IPs.
Detection coverage 3
Suspicious Cmd.exe Activity with Encoded or Obfuscated Arguments
highDetects cmd.exe executing with command line arguments often used for encoding, obfuscation, or downloading malicious payloads.
Cmd.exe with Suspicious Parent Process
mediumDetects cmd.exe being spawned by unusual parent processes like wscript.exe or mshta.exe
Cmd.exe Writing VBS or JS Files
highDetects cmd.exe writing VBScript or JavaScript files, often indicative of script-based attacks.
Detection queries are kept inside the platform. Get full rules →