Cursed Packets Cookbook: Weird Frames, Middlebox Lies & 3 AM Reproducers
Four copy-paste packet war stories for catching forged middlebox TCP resets, 802.1ad QinQ native-VLAN leaks, IDS stream-reassembler edge cases, and offline OT coil writes.
- When a firewall vendor swears "we never inject TCP resets," compare the SYN-ACK TTL (
52) against the sudden RST TTL (251) and IPID (0x0000). - OS network stacks refuse to emit double-tagged QinQ hops, duplicate TCP sequence offsets, or forged TTLs — writing
.frasmputs exact wire bytes into a.pcapin under a millisecond. - Every recipe below compiles straight to
.pcapor.pcapngwith valid Ethernet/IP/TCP/CRC checksums so NICs and Wireshark dissectors take the bait.
1. The Lying Middlebox ("It Works on Curl, Dies on Real SNI")
It is 2:14 AM. The application team blames the network; the firewall admin swears on a stack of RFCs that nothing sits inline; and your TLS handshake dies 400 microseconds after ClientHello — faster than the speed of light to the actual server in Frankfurt.
Dead giveaway in Wireshark: the real server (innocent-api) answered SYN-ACK with ttl 52 after twelve router hops, yet the RST+ACK shows up with ttl 251, ipid 0x0000, and win 0. Build a clean 5-frame training or regression .pcap that reproduces the exact crime scene:
// Exhibit A: Why did Frankfurt answer in 0.4ms with TTL 251?host laptop-of-doom { ip 10.42.10.99 mac 00:1b:21:aa:bb:01 }host innocent-api { ip 198.51.100.42 mac 00:1c:73:00:00:01 }compile { // Real server sits 12 router hops away (64 - 12 = TTL 52) laptop-of-doom -> innocent-api tcp syn srcport 54321 dstport 443 ttl 64 win 65535 mss 1460 wscale 7 sackperm wait 14ms laptop-of-doom <- innocent-api tcp syn ack ttl 52 ipid 0x4a21 win 65535 mss 1460 wscale 7 sackperm wait 1ms laptop-of-doom -> innocent-api tcp ack ttl 64 wait 1ms // SNI leaves the laptop... and an inline DPI box panics 400us later laptop-of-doom -> innocent-api tls clienthello sni "git.shadow-ops.example" ciphersuite 0x1301 alpn "h2" ttl 64 wait 400us laptop-of-doom <- innocent-api tcp rst ack ttl 251 ipid 0x0000 win 0}# Compile and spot the sudden TTL jump (52 -> 251) in tshark
frameassembly middlebox_rst_autopsy.frasm
tshark -r middlebox_rst_autopsy.pcap -T fields -e frame.number -e frame.time_relative -e ip.ttl -e ip.id -e tcp.flags.strFilter on tcp.flags.reset == 1 && ip.id == 0 (or watch ip.ttl jump by 60+ mid-stream). Real servers rarely teleport 11 hops closer right before hanging up.
2. The Chatty Office Printer & the Native-VLAN QinQ Hop
Every corporate floor has one dusty printer from 2009 quietly broadcasting its firmware life story over lldp every 30 seconds. Worse, if the switch port still leaves VLAN 1 untagged as the native trunk VLAN, an outer 0x88a8 tag (qinq 1 innervlan 20) gets popped on the first trunk and coasts straight into VLAN 20.
Because desktop OS drivers strip VLAN tags on sight, testing whether your access switch drops double-tagged frames used to mean dragging a managed switch onto your desk. Here it is in three lines:
// Step 1: Chatty LLDP confession · Step 2: Outer VLAN 1 -> Inner VLAN 20 hophost printer-on-vlan1 { ip 10.1.1.250 mac 00:11:0a:99:88:77 }host core-trunk-sw { mac 00:1c:73:aa:00:01 }host finance-db { ip 10.1.20.54 mac 00:50:56:bb:20:54 }compile { // Unsolicited LLDP broadcast to 01:80:c2:00:00:0e printer-on-vlan1 -> core-trunk-sw lldp chassisid "JetDirect-3F-Breakroom" portid "eth0" ttl 120 sysname "laserjet-2009.local" sysdesc "BootROM 1999; telnet enabled" wait 2ms // Double-tagged 802.1ad S-VLAN 1 + 802.1Q C-VLAN 20 knocking on Postgres printer-on-vlan1 -> finance-db qinq 1 innervlan 20 tcp syn srcport 60123 dstport 5432 win 64240 mss 1460 wait 2ms printer-on-vlan1 -> finance-db vlan 20 icmp echorequest id 0xbeef seq 1 payload "who-left-vlan1-native?"}3. Overlapping TCP seq Retransmits (First-Seen vs. Last-Seen)
Normally FrameAssembly tracks 4-tuple seq and acknum automatically so you never touch a hex calculator. When you *want* to be evil to a stream reassembler, passing an explicit seq number overrides the counter on that frame and re-anchors the stream.
Classic IDS evasion check: send two PSH+ACK segments at the exact same seq 1001 (wait 500us apart) with different HTTP URIs, and verify whether Suricata, Zeek, or your reverse proxy inspects the decoy or the second segment:
// Stream-reassembler quiz: two payloads claiming TCP seq 1001host sneaky-client { ip 172.16.50.15 }host confused-ids { ip 172.16.50.80 }compile { sneaky-client -> confused-ids tcp syn srcport 51999 dstport 80 win 65535 mss 1460 wait 1ms sneaky-client <- confused-ids tcp syn ack win 65535 mss 1460 wait 1ms sneaky-client -> confused-ids tcp ack wait 1ms // Segment A at seq 1001 (TTL 3 — maybe it expires before reaching the web box?) sneaky-client -> confused-ids http get uri "/index.html" hosthdr "app.lab.local" seq 1001 ttl 3 wait 500us // Segment B 500us later at the SAME seq 1001 with full TTL 64 sneaky-client -> confused-ids http get uri "/admin/debug-vars" hosthdr "app.lab.local" seq 1001 ttl 64}# Feed straight into Suricata and Zeek offline to see which URI gets logged
frameassembly seq_retransmit_puzzle.frasm
suricata -r seq_retransmit_puzzle.pcap -k none -l ./suricata-retransmit
zeek -C -r seq_retransmit_puzzle.pcap4. The 4:55 PM Friday Modbus Coil & DNP3 Breaker Test
Nothing spices up a Friday afternoon like someone asking "hey, can you verify our new OT firewall blocks Modbus coil writes and DNP3 Operate commands?" Do *not* test that against a real substation RTU or water-pump PLC.
Compile a clean 6-frame .pcap with valid TCP 502 sequence tracking and real IEEE 1815 DNP3 per-chunk CRC-16 checksums, then feed it into your sensor or isolated bench firewall while the real machinery stays blissfully untouched:
// Zero turbines harmed: polite read -> unauthorized coil flip -> DNP3 CROBhost rogue-eng-laptop { ip 192.168.120.99 }host innocent-plc { ip 192.168.120.10 }compile { rogue-eng-laptop -> innocent-plc tcp syn srcport 50502 dstport 502 win 64240 mss 1460 vlan 120 wait 1ms rogue-eng-laptop <- innocent-plc tcp syn ack win 64240 mss 1460 vlan 120 wait 1ms rogue-eng-laptop -> innocent-plc tcp ack vlan 120 wait 1ms // 1. Allowed SCADA poll (FC 03 Read Holding Registers) rogue-eng-laptop -> innocent-plc modbus readholdingregisters txid 10 unitid 1 addr 40001 count 2 vlan 120 wait 2ms // 2. Career-limiting FC 05 Write Single Coil (should trigger OT block!) rogue-eng-laptop -> innocent-plc modbus writesinglecoil txid 11 unitid 1 addr 1 value 0xff00 vlan 120 wait 3ms // 3. DNP3 Direct Operate over UDP 20000 (auto-computes IEEE 1815 CRC-16 chunks) rogue-eng-laptop -> innocent-plc transport udp dnp3 directoperate src 3 dst 10 group 12 variation 1 vlan 120}| Cursed Symptom | Wireshark Display Filter | What .frasm Modifier Crafts It |
|---|---|---|
| Forged middlebox TCP reset | tcp.flags.reset == 1 && ip.ttl > 200 | tcp rst ack ttl 251 ipid 0x0000 win 0 |
| 802.1ad QinQ double-VLAN hop | vlan.etype == 0x88a8 | qinq 1 innervlan 20 |
Duplicate / overlapping TCP seq | tcp.analysis.retransmission | Explicit seq 1001 on two consecutive frames (ttl 3 vs ttl 64) |
| Unauthorized OT coil / breaker write | modbus.func_code == 5 || dnp3.al.func == 5 | modbus writesinglecoil value 0xff00 / dnp3 directoperate |