Skip to content

fix(net): guard NULL ifa_addr in IPv4 iface scan + validate extra-interface bridge name (1.1.24)#227

Merged
click0 merged 1 commit into
mainfrom
claude/analyze-test-coverage-nCOJW
Jul 11, 2026
Merged

fix(net): guard NULL ifa_addr in IPv4 iface scan + validate extra-interface bridge name (1.1.24)#227
click0 merged 1 commit into
mainfrom
claude/analyze-test-coverage-nCOJW

Conversation

@click0

@click0 click0 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

The two low-severity findings from the second-pass audit that don't need on-hardware validation — both are compile-gated by the FreeBSD build.

1. Null-pointer dereference in getIfaceIp4Addresseslib/net.cpp

The IPv4 interface loop dereferenced a->ifa_addr->sa_family without a NULL check, while the IPv6 sibling (getIfaceIp6Addresses) already guards ifa_addr == nullptr. getifaddrs(3) can return entries with a NULL ifa_addr (an interface with no address — e.g. a freshly created epair before configuration), so the IPv4 path could crash (local DoS). The loop now mirrors the IPv6 one: it skips NULL ifa_addr, non-AF_INET, name mismatches, and NULL ifa_netmask.

2. Extra-interface bridge name not validated — lib/run.cpp

The primary bridge path runs optionNet->bridgeIface through BridgePure::validateBridgeName, but the extra-interfaces loop passed ex.bridgeIface straight into RunNet::createBridgeEpairifconfig <bridge> addm <member>. A leading-- value is taken as an ifconfig(8) option (argument injection; no shell involved). The loop now validates the name the same way as the primary path.

Testing

BridgePure::validateBridgeName (rejects the leading dash, shell metacharacters, .., and over-length names) is already covered by bridge_pure_test — I confirmed locally it rejects -abc and accepts bridge0. The net.cpp change is runtime-only (no pure unit surface) and is compile-gated by the FreeBSD lite build.

Remaining after this

The three items that genuinely need FreeBSD on-hardware validation stay deferred in TODO: the lease-file flock-on-renamed-inode race (network_lease*.cpp), the run.cpp exception-path teardown ordering, and the socket_proxy/proxy path confinement. These are blocked on the FreeBSD CI/validation infra (self-hosted runner or Cirrus), not on any further analysis.

Version

Bumps to 1.1.24; CHANGELOG.md + docs/trust-model.{md,uk.md} updated.

🤖 Generated with Claude Code


Generated by Claude Code

…erface bridge name (1.1.24)

Two low-severity, compile-gated fixes from the second-pass audit:

- lib/net.cpp getIfaceIp4Addresses dereferenced a->ifa_addr->sa_family
  without a NULL check while the IPv6 sibling guards it. getifaddrs(3)
  can return entries with NULL ifa_addr (interface with no address,
  e.g. a fresh epair), so the IPv4 path could crash (local DoS). The
  loop now mirrors the IPv6 one: skip NULL ifa_addr, non-AF_INET, name
  mismatch, and NULL ifa_netmask.

- lib/run.cpp extra-interfaces loop passed ex.bridgeIface straight into
  RunNet::createBridgeEpair -> `ifconfig <bridge> addm <member>` with no
  validation, while the primary bridge path runs it through
  BridgePure::validateBridgeName. A leading-'-' value is taken as an
  ifconfig(8) option (argument injection). The loop now validates the
  name the same way.

validateBridgeName (rejects leading dash / shell metachars / .. /
over-length) is already covered by bridge_pure_test; the net.cpp change
is runtime-only. Bumps to 1.1.24; CHANGELOG + trust-model (en/uk).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X6t6tzVypHye5bDGLxzmZK
@click0
click0 merged commit d859860 into main Jul 11, 2026
2 checks passed
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.

2 participants