Exfiltration over ICMP

MITRE ATT&CK™ - Exfiltration Over Alternative Protocol - Technique T1048

Theory

The Internet Control Message Protocol (ICMP) is a supporting protocol in the Internet protocol suite. It is used by network devices, including routers, to send error messages and operational information indicating success or failure when communicating with another IP address (Wikipedia).

ICMP Data Section

At a high level, an ICMP packet consists of multiple fields, including a Data section. This section can contain arbitrary information, such as diagnostic messages, test payloads, or even copied portions of other network packets (e.g., IPv4 headers for error reporting). The following diagram illustrates the Data section, which is optional but can be leveraged for various purposes, including covert communication.

Notably, RFC 792 (which defines ICMP) does not impose any strict requirements on the content of the Data field. This means that any data can be transmitted, as long as the overall structure of the ICMP packet remains valid.

Practice

Linux Target

We can, on linux targets, exfiltrate datas with the -p options of the ping command.

On the attacking machine, we can receive the data as follows

To facilitate file exfiltration and remove the limit of 16 bytes in the data field using the native ping command, you can alternatively employ ICMP-Data-Exfiltration (python).

Windows Target

On a Windows victime, we may exfiltrate data over ICMP using poweshell

On the attacking machine, we can receive the data as follows

Resources

Last updated

Was this helpful?