247CTF - Error Reporting Protocol

posted
read
53 words · 1 min
contents

Identify the flag hidden within error messages of ICMP traffic captured in a PCAP file.

Vulnerability

ICMP packets (ping replies) can carry data in their payload. The flag is exfiltrated through ICMP echo replies. ICMP is often overlooked as a potential data exfiltration channel.

Solution

#!/usr/bin/env python3
from scapy.all import rdpcap
from scapy.layers.inet import ICMP
packets = rdpcap("error_reporting.pcap")
flag = b""
for p in packets:
# ICMP type 0 = Echo Reply (responses to ping requests)
if p.haslayer(ICMP) and p[ICMP].type == 0 and p.haslayer("Raw"):
flag += p["Raw"].load
with open("flag.jpg", "wb") as f:
f.write(flag)
print("[+] Extracted data saved to flag.jpg")

The extracted data is a JPG image containing the flag.

247CTF{[flag redacted]}