Cross-source coverage
T1205.001 / ATT&CK
Traffic Signaling: Port Knocking
6 rules · 5 families across 3 sources.
Showing deprecated rules · back to the default
From MITRE ATT&CK 19.2
Adversaries may use port knocking to hide open ports used for persistence or command and control. To enable a port, an adversary sends a series of attempted connections to a predefined sequence of closed ports. After the sequence is completed, opening a port is often accomplished by the host based firewall, but could also be implemented by custom software.
This technique has been observed both for the dynamic opening of a listening port as well as the initiating of a connection to a listening server on a different system.
The observation of the signal packets to trigger the communication can be conducted through different methods. One means, originally implemented by Cd00r, is to use the libpcap libraries to sniff for the packets in question. Another method leverages raw sockets, which enables the malware to use ports that are already open for use by other programs.
- Tactics
- Stealth · Persistence · Command and Control
- Platforms
- Linux · macOS · Network Devices · Windows
- Telemetry
-
WinEventLog:SysmonWinEventLog:Microsoft-Windows-Windows Firewall With Advanced Security/Firewallauditd:SYSCALLNSM:Flowmacos:unifiedlognetworkdevice:syslog
How MITRE says to detect it DET0302
Port-knock → rule/daemon change → first successful connect (T1205.001)
Windows Analytic 0842
A remote source rapidly touches a short sequence of closed ports (SYN→RST/S0) on a Windows host. Within a short window the host changes firewall state (WFP rule added/modified or service starts listening) and then the same source completes the first successful handshake to the newly opened port.
WinEventLog:SysmonEventCode=1WinEventLog:SysmonEventCode=3, 22WinEventLog:Microsoft-Windows-Windows Firewall With Advanced Security/FirewallEventCode=2004, 2005, 2006
Linux Analytic 0843
A source performs a short closed-port sequence; the host then modifies iptables/nftables/ufw rules or starts a daemon binding a new socket, followed by a successful connection from the same source.
auditd:SYSCALLexecve: Commands that alter firewall or start listeners: iptables|nft|ufw|firewall-cmd|pfctl|systemctl start sshd/telnet/dropbear; raw-socket/libpcap tools (tcpdump, tshark, nmap --raw).auditd:SYSCALLsocket/bind: New bind() to a previously closed port shortly after the sequence.NSM:FlowKnock pattern: repeated REJ/S0 across ≥MinSequenceLen ports from same src_ip then SF success.
macOS Analytic 0844
A source performs a closed-port sequence; the endpoint enables a PF/socketfilterfw rule or a background process binds a port; then a successful connection completes from the same source.
macos:unifiedlogexec: Execution of pfctl, socketfilterfw, launchctl start ssh/telnet, libpcap consumers.macos:unifiedlogFirewall/PF anchor load or rule change events.NSM:FlowSequence of REJ/S0 then SF success from same src_ip within TimeWindow.
Network Devices Analytic 0845
Router/switch receives a knock pattern (same src touches device unicast, broadcast, and network-address on same or stepped ports) followed by ACL/line-vty/service enable and the first mgmt session success.
networkdevice:syslogConfig/ACL changes, line vty transport input changes, telnet/ssh/http(s) enable, image/feature module changes.NSM:FlowSeries of denied/closed flows to distinct ports then success to mgmt port from same src_ip within TimeWindow.
chainguard-dev/osquery-defense-kit
3 rules · 2 families| Detection | Severity | Format |
|---|---|---|
| Find root-run processes which link against libpcap 2 variants | Undefined | osquery SQL |
| Find root-run processes which link against libpcap 2 variants | Undefined | osquery SQL |
| Find root-run processes which link against libpf | Undefined | osquery SQL |
elastic/detection-rules
2 rules| Detection | Severity | Format |
|---|---|---|
| Potential Linux Reverse Connection through Port Knocking | Low | Elastic TOML |
| Unusual Linux Network Port Activity | Low | Elastic TOML |
falcosecurity/rules
1 rule| Detection | Severity | Format |
|---|---|---|
| Unexpected K8s NodePort Connection | Low | Falco YAML |