Port Knocking

From enterprise
Jump to: navigation, search
Port Knocking
ID T1205
Tactic Command and Control, Defense Evasion, Persistence
Platform Linux, macOS
Permissions Required User

Port Knocking is a well-established method used by both defenders and adversaries to hide open ports from access. To enable the port, the system expects a series of packets with certain characteristics before the port will be opened. This is often accomlished by the host based firewall, but could also be implemented by custom software.

This technique has been observed to 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.


  • Chaos provides a reverse shell is triggered upon receipt of a packet with a special string, sent to any port.1
  • Umbreon Umbreon provides additional access using its backdoor Espeon, providing a reverse shell upon receipt of a special packet 2


Mitigation of some variants of this technique could be achieved through the use of stateful firewalls, depending upon how it is implemented.


Record network packets sent to and from the system, looking for extraneous packets that do not belong to established flows.