ICMP tunnelling
termKept in this browser · My desk
Carrying data or commands in the payload of ICMP messages, usually echo requests and replies, which many networks pass without looking inside.
The ICMP specification requires an echo reply to return the echo's data unchanged and says nothing about what the data may be. Project Loki, published in Phrack in 1996, described the channel and LOKI2 (1997) implemented it with encryption; MITRE lists malware families that use ICMP for command and control.
How it works. An Internet Control Message Protocol (ICMP) echo message, type 8, and its echo reply, type 0, carry a code of 0, a checksum, a 16-bit identifier, a 16-bit sequence number and then data of any length. Request for Comments (RFC) 792 (September 1981) says the data received in an echo must be returned in the reply, and RFC 1122 (October 1989) made the rule stricter: every host must implement an echo server, and data received in an echo request must be entirely included in the reply, truncated only where sending it would need fragmentation that is not implemented. Neither standard says what the data may be. A tunnel client therefore puts its traffic in the data of echo requests, a server outside answers with replies whose data carry the return traffic, and a firewall that passes ping without looking inside passes the conversation. Because the outside party speaks only when the inside client asks, tools keep a steady stream of requests going to poll for commands.
History. In Phrack 49, in a file dated August 1996, daemon9 (also known as route) and Alhambra published Project Loki: arbitrary information could ride in echo and echo reply data, a form of steganography in their words; detection would be hard if traffic stayed low and the server hid in the kernel; a surplus of echo replies with garbled payloads was the clue; accepting echo only from trusted hosts was useless because source addresses can be forged; and the only sure cure was to deny all incoming echo. LOKI2, in Phrack 51 of 1 September 1997, tunnelled shell commands in ICMP echo and in Domain Name System (DNS) messages, with Blowfish and a Diffie-Hellman key exchange, a weak XOR (exclusive or) or no encryption, and could swap protocols on the fly. By 2006 the Centro de Atendimento a Incidentes de Segurança (CAIS) of Brazil's Rede Nacional de Ensino e Pesquisa (RNP) listed ICMPTX, itun, PingTunnel and ptunnel, which carry whole Internet Protocol (IP) connections over echo types 0 and 8, and gave a detection hint: the magic number 0xD5200880 that identifies ptunnel.
In the wild. MITRE ATT&CK (Adversarial Tactics, Techniques, and Common Knowledge) files ICMP command and control under non-application-layer protocols, T1095, with PingPull, PHOREAL and COATHANGER among its procedure examples, and notes that ICMP is less commonly monitored than the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP). Palo Alto Networks' Unit 42 described PingPull on 13 June 2022 as a remote access trojan of GALLIUM, a group it assesses as likely Chinese state-sponsored, with variants for ICMP, for the Hypertext Transfer Protocol (HTTP) and its secure form HTTPS, and for raw TCP. The ICMP variant beacons with echo requests whose data hold, in some samples, a hard-coded 8-byte value, then the letter R, a sequence number for messages too long for one packet, an identifier beginning PROJECT, total and current lengths and data encrypted with the Advanced Encryption Standard (AES) and encoded in Base64; the server issues commands in echo replies. Wojciech Mazurczyk and Luca Caviglione describe Regin, disclosed in November 2014, as tunnelling secrets in ICMP ping traffic as well as in HTTP cookies.
What a normal ping looks like. Windows ping sends 32 bytes of data by default and accepts up to 65,500; iputils ping on Linux sends 56 data bytes by default, 64 with the 8-byte ICMP header, starting with a timestamp structure followed by pad bytes, of which the user may set at most 16 with -p. Echo payloads of other sizes, data that is not the fixed pattern of a ping program, long sustained echo exchanges with one external address and echo sent by a process that is not a diagnostic tool are the anomalies that separate a tunnel from troubleshooting. Signatures catch known tools, as Unit 42's Threat Prevention signatures 86625 to 86627 do for PingPull; the anomalies catch the rest.
Defences. Loki's authors advised denying all incoming echo, but dropping ICMP wholesale breaks path maximum transmission unit (MTU) discovery and diagnostics. RFC 4890 (May 2007) lists the ICMP version 6 (ICMPv6) messages a firewall must pass and warns in section 3.5 that error messages which must pass in both directions can carry a covert conversation or a tunnel, recommending deep packet inspection to check that the packet quoted inside an error belongs to legitimate traffic. Rate limits, size limits and alerts on echo payloads that ping programs do not send are the practical middle way. Normalization helps only at the margin: Cisco's inline normalization can clear the 8-bit code field of echo requests and replies, which removes a tiny storage channel but not a tunnel in the data. The strongest single clue is on the endpoint: which process sent the echo.
Neighbours. DNS tunnelling is the same idea in a protocol that the organization's own resolvers forward for the attacker; traceroute and path MTU discovery are the legitimate ICMP uses that wholesale blocking breaks; traffic normalization and deep packet inspection are the network controls, and exfiltration and command and control the purposes.
Also known as: icmp tunneling, icmp tunnel, ping tunnel, tunelamento icmp
Sources
- J. Postel, RFC 792, Internet Control Message Protocol, September 1981 (read 2026-11-23): the data received in an echo message must be returned in the echo reply
- daemon9 and Alhambra, Project Loki: ICMP Tunneling, Phrack 49, file 6, dated August 1996 (read 2026-11-23): arbitrary information in the data of ICMP echo and echo reply; called a form of steganography; detection hard if traffic stays low; deny all echo as the only sure cure
- daemon9, LOKI2 (the implementation), Phrack 51, file 6, 1 September 1997 (read 2026-11-23): shell commands tunnelled in ICMP echo and DNS; Blowfish with Diffie-Hellman, XOR or no encryption; protocol swapping
- E. Davies and J. Mohacsi, RFC 4890, May 2007 (read 2026-11-23): section 3.5, ICMPv6 errors that must pass a firewall both ways can carry a covert conversation or tunnel; deep inspection of the quoted packet
- MITRE ATT&CK, Non-Application Layer Protocol, T1095, last modified 3 September 2026 (read 2026-11-23): ICMP used for command and control by PingPull, PHOREAL, COATHANGER and others; ICMP less commonly monitored than TCP or UDP
- R. Braden (ed.), RFC 1122, Requirements for Internet Hosts: Communication Layers, October 1989 (read 2026-11-23): section 3.2.2.6, every host must implement an ICMP echo server; data received in an echo request must be entirely included in the echo reply, truncated only if intentional fragmentation is needed and not implemented
- Palo Alto Networks Unit 42, GALLIUM Expands Targeting Across Telecommunications, Government and Finance Sectors With New PingPull Tool, 13 June 2022 (read 2026-11-23): PingPull, a remote access trojan with ICMP, HTTP(S) and raw TCP variants; the ICMP variant uses echo requests and replies whose data carry an optional hard-coded 8-byte value, R, a sequence number, a PROJECT identifier, total and current lengths and Base64-encoded AES-encrypted data; few organizations inspect ICMP; Threat Prevention signatures 86625 to 86627
- Microsoft Learn, ping (Windows commands) (read 2026-11-23): -l sets the length of the Data field of echo requests; the default is 32 bytes and the maximum 65,500
- iputils, ping(8) manual page, man7.org (read 2026-11-23): echo requests carry an IP and ICMP header, a struct timeval and pad bytes; -s defaults to 56 data bytes, 64 with the 8-byte ICMP header; -p sets up to 16 pad bytes
- Ivo de Carvalho Peixinho, RNP, CAIS, Covert channels: o que são, o que fazem e como se prevenir contra eles, GTS-8, December 2006, Registro.br archive (read 2026-11-23): header channels, ICMP tunnels (ICMPTX, itun, PingTunnel, ptunnel on echo types 0 and 8), DNS tunnels; the ptunnel magic number 0xD5200880; detection and blocking measures
- Wojciech Mazurczyk and Luca Caviglione, Information Hiding as a Challenge for Malware Detection, arXiv:1504.04867, 2015 (read 2026-11-23): Regin, disclosed in November 2014, tunnelled secrets in ICMP ping traffic and in HTTP cookies and custom TCP and UDP packets
- Cisco Security Cloud Control documentation, cloud-delivered Firewall Management Center, Inline Normalization Options (read 2026-11-23): clears the IPv4 reserved flag bit, the Differentiated Services byte, TCP reserved bits and option padding, the urgent pointer when URG is not set and the 8-bit code of ICMP echo messages; removes data on SYN and RST; trims data to window or MSS; sets TCP options other than MSS, window scale, timestamp and allowed ones to No Operation; on Firewall Threat Defense routed and transparent interfaces the TTL of a connection can decrease but never increase