Skip to content

netutils/dhcp6c: validate stored option lengths - #3898

Merged
acassis merged 1 commit into
apache:masterfrom
anchao:26102202
Oct 23, 2026
Merged

acassis merged 1 commit into
apache:masterfrom
anchao:26102202

Conversation

@anchao

@anchao anchao commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Harden DHCPv6 client result parsing against malformed options from a malicious DHCPv6 server.

The result path trusted stored IA_NA, IA_PD, and DNS option data before copying fixed-size IPv6 addresses into the reported client state. A truncated IA option or missing/short DNS option could trigger an out-of-bounds read or NULL pointer dereference.

Changes

  • Validate stored IA_NA address options before reading the IPv6 address field.
  • Validate stored IA_PD prefix options before reading the prefix and IPv6 address fields.
  • Only copy DNS server data when at least one complete IPv6 address is present.
  • Skip malformed stored options instead of consuming short buffers.

Testing

sim/pktradio

The DHCPv6 client result path trusted previously stored IA_NA, IA_PD,
and DNS option data before copying fixed-size IPv6 addresses into the
reported client state.  A malicious DHCPv6 reply could provide truncated
options, or omit DNS data entirely, and later trigger an out-of-bounds
read or NULL pointer dereference while building the callback result.

Check that stored IA address and prefix options have enough payload for
the fixed fields being read, and only copy DNS data when a complete IPv6
address is present.  Skip malformed stored options instead of consuming
short buffers.

Signed-off-by: chao an <anchao.archer@bytedance.com>
@acassis
acassis merged commit 75b498c into apache:master Oct 23, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants