Skip to content

Never read a damaged or blind lifecycle capture as contained - #183

Merged
onyks-os merged 1 commit into
mainfrom
test/o02-capture-readers
Nov 23, 2026
Merged

onyks-os merged 1 commit into
mainfrom
test/o02-capture-readers

Conversation

@onyks-os

Copy link
Copy Markdown
Owner

This PR covers O02 from docs/security/leak-testing-plan.md (slice 3), for the lifecycle VM's capture reader.

The defect

scripts/vm/lifecycle/run.sh passes a contained scenario when egress.py --hits prints 0. Before this PR, egress.py produced that 0, or a wrong verdict, without having seen anything:

  • An empty pcap or a short header gave 0.
  • Truncated records, VLAN-tagged frames and unknown EtherTypes were dropped silently.
  • For non-first IPv4 fragments, ports were read from the payload.
  • Parsing stopped at the first IPv6 extension header.
  • Nothing checked that the window showed the guest's egress at all. A capture of replies only passed.

The fix

  • egress.py now raises Inconclusive in each of these cases, printing INCONCLUSIVE: <reason> on stderr and exiting 2:
    • a damaged or non-Ethernet file;
    • a frame snapped below its addresses;
    • a layout the reader does not parse.
  • QEMU's intentional 128-byte snap length still gives a verdict, because the destination address is all a verdict needs.
  • A new --require-control option requires guest-originated SSH packets in the window.
  • run.sh records an inconclusive capture as a failed scenario and quotes the reason.
  • run.sh now sends an SSH beacon inside the c0-control and s1-session windows. The other windows already carry SSH traffic.

Tests

tests/test_lifecycle_egress.py builds the pcaps byte by byte (27 cases):

  • empty, short, bad-magic, non-Ethernet, truncated and impossible-length files;
  • header-only, replies-only and another-guest or wrong-NIC windows;
  • VLAN, unknown EtherType, snapped-below-destination, malformed and runt frames;
  • fragments and IPv6 extension chains;
  • the intentional snap length.

26 of the 27 cases fail against the old reader.

The lifecycle VM workflow runs on this PR because of its path filter. That run is what shows the control beacons are actually seen.

🤖 Generated with Claude Code

O02 of the leak-testing plan, for the lifecycle VM's capture reader.

run.sh passes a contained scenario when egress.py --hits prints 0, and
egress.py printed 0 for an empty pcap, a short header, and silently
dropped truncated records, VLAN frames and unknown EtherTypes. It also
read ports from the payload of non-first IPv4 fragments and stopped at
the first IPv6 extension header.

egress.py now raises Inconclusive (stderr INCONCLUSIVE: <reason>, exit 2)
for any damage, for a frame snapped below its addresses and for layouts
it does not parse; QEMU's intentional 128-byte snap still gives a
verdict. --require-control demands the guest's own SSH packets in the
window, so a capture of replies only or of nothing is blind, not clean.

run.sh records an inconclusive capture as a failed scenario with the
reason, and sends a control beacon (an SSH round trip) inside the
c0-control and s1-session windows; the other windows already carry SSH
traffic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: onyks-os <129986281+onyks-os@users.noreply.github.com>
@onyks-os
onyks-os merged commit 50bcd7c into main Nov 23, 2026
30 checks passed
@onyks-os
onyks-os deleted the test/o02-capture-readers branch November 23, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant