Tunneling and/or Port Forwarding Detected via Defend for Containers

Last updated 15 days ago on 2026-02-10
Created 15 days ago on 2026-02-10

About

This rule detects the use of tunneling and/or port forwarding tools inside a container. This could indicate a threat actor is using these tools to communicate with a C2 server, is attempting to exfiltrate data from the container, or is attempting to pivot within the container network.
Tags
Data Source: Elastic Defend for ContainersDomain: ContainerOS: LinuxUse Case: Threat DetectionTactic: Command and ControlLanguage: eql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Command and Control (TA0011)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-cloud_defend.process*
Related Integrations

cloud_defend(external, opens in a new tab or window)

Query
text code block:
process where event.type == "start" and event.action == "exec" and ( ( // Tunneling and/or Port Forwarding via process args (process.args regex """.*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{1,5}:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{1,5}.*""") or // gost (process.name == "gost" and process.args : ("-L*", "-C*", "-R*")) or // ssh (process.name == "ssh" and (process.args like ("-*R*", "-*L*", "-*D*", "-*w*") and not (process.args == "chmod" or process.args like "*rungencmd*"))) or // ssh Tunneling and/or Port Forwarding via SSH option (process.name == "ssh" and process.args == "-o" and process.args like~( "*ProxyCommand*", "*LocalForward*", "*RemoteForward*", "*DynamicForward*", "*Tunnel*", "*GatewayPorts*", "*ExitOnForwardFailure*", "*ProxyCommand*", "*ProxyJump*" )) or // sshuttle (process.name == "sshuttle" and process.args in ("-r", "--remote", "-l", "--listen")) or // earthworm (process.args == "-s" and process.args == "-d" and process.args == "rssocks") or // socat (process.name == "socat" and process.args : ("TCP4-LISTEN:*", "SOCKS*")) or // chisel (process.name : "chisel*" and process.args in ("client", "server")) or // iodine(d), dnscat, hans, ptunnel-ng, ssf, 3proxy & ngrok (process.name in ("iodine", "iodined", "dnscat", "hans", "hans-ubuntu", "ptunnel-ng", "ssf", "3proxy", "ngrok", "wstunnel", "pivotnacci", "frps", "proxychains")) ) ) and container.id like "?*"

Install detection rules in Elastic Security

Detect Tunneling and/or Port Forwarding Detected via Defend for Containers in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).