Skip to content

Reject fragmented gateway traffic in the DHCP classifier - #207

Open
RainieLLM wants to merge 1 commit into
openai:mainfrom
RainieLLM:fix/reject-fragmented-gateway-udp
Open

RainieLLM wants to merge 1 commit into
openai:mainfrom
RainieLLM:fix/reject-fragmented-gateway-udp

Conversation

@RainieLLM

@RainieLLM RainieLLM commented Sep 19, 2026 •

Copy link
Copy Markdown

Fixes #197

Summary

The DHCP reply classifier parsed the UDP header before it checked the IPv4 fragment fields. A fragmented reply could then be treated as NotDhcp. In stateless mode, that path allowed the packet without the VM MAC check, so a foreign DHCP reply could reach the guest.

This change rejects gateway fragments before the UDP parse. Complete replies keep the existing VM MAC check. Fragments from other sources remain NotDhcp.

Tests

The new tests cover first and later gateway fragments, valid and foreign complete replies, and fragments from other sources.

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --lib proxy::host::tests

The classifier in proxy::host reads a gateway DHCP reply to find the VM
MAC. It looked at the first fragment only. An attacker on the gateway
link could split the reply so the first fragment holds no complete
BOOTP header. The classifier then read past it and matched the wrong
bytes. That let traffic through the gateway check.

Check the fragment offset before the parse. A reply that arrives in more
than one fragment is now rejected, since a real DHCP reply from the
gateway is a single datagram. Add tests for the fragmented and
unfragmented cases.
@RainieLLM
RainieLLM force-pushed the fix/reject-fragmented-gateway-udp branch from cb1dcf7 to f6f5280 Compare September 19, 2026 01:48

This branch has not been deployed

No deployments
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.

Investigate the feasibility of rejecting the fragmented traffic

1 participant