Cross-source coverage

T1205.001 / ATT&CK

Traffic Signaling: Port Knocking

5 rules · 4 families across 3 sources.

1 deprecated hidden · include

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.

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:Sysmon EventCode=1
  • WinEventLog:Sysmon EventCode=3, 22
  • WinEventLog:Microsoft-Windows-Windows Firewall With Advanced Security/Firewall EventCode=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:SYSCALL execve: 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:SYSCALL socket/bind: New bind() to a previously closed port shortly after the sequence.
  • NSM:Flow Knock 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:unifiedlog exec: Execution of pfctl, socketfilterfw, launchctl start ssh/telnet, libpcap consumers.
  • macos:unifiedlog Firewall/PF anchor load or rule change events.
  • NSM:Flow Sequence 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:syslog Config/ACL changes, line vty transport input changes, telnet/ssh/http(s) enable, image/feature module changes.
  • NSM:Flow Series 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

1 rule
Detection Severity Format
Unusual Linux Network Port Activity Low Elastic TOML

falcosecurity/rules

1 rule
Detection Severity Format
Unexpected K8s NodePort Connection Low Falco YAML

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.