Skip to content

doc: record open ephemeral port allocation issues - #195

Merged
douglasmun merged 1 commit into
mainfrom
docs/ephemeral-port-issues
Oct 21, 2026
Merged

douglasmun merged 1 commit into
mainfrom
docs/ephemeral-port-issues

Conversation

@douglasmun

Copy link
Copy Markdown
Owner

Adds doc/EPHEMERAL_PORT_ISSUES.md, a read-only review of ephemeral port allocation. No code changes; the fix is deferred.

  • Sequential TCP ports: tcp_allocate_port() starts at 49152 on every boot and counts up. DNS already randomises from the CSPRNG.
  • Dead exhaustion check: tcp.c:455 can never trigger.
  • Collision check uses the local port only: it ignores the remote address. Recorded, not a defect at 8 connections.
  • TIME_WAIT comment overstates the protection: early eviction frees ports before 30 s. Sequential allocation hides this today, and randomising would expose it.
  • Inconsistent locking: kernel-shell tcp_connect callers allocate a port outside TCP_LOCK.

None of these is exploitable on its own: the stack is client-only and the ISN is keyed (RFC 6528). The doc includes a verification plan for the eventual fix.

🤖 Generated with Claude Code

TCP source ports are a sequential counter starting at 49152 every boot
(RFC 6056 recommends obfuscation; DNS already randomises). Also records a
dead exhaustion check, local-port-only collision check, a TIME_WAIT
comment that overstates protection (early eviction frees ports before
30 s, which randomisation would expose), and allocation running outside
TCP_LOCK on kernel-shell callers. No code change; fix deferred.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@douglasmun
douglasmun merged commit 0f03f03 into main Oct 21, 2026
2 checks passed
@douglasmun
douglasmun deleted the docs/ephemeral-port-issues branch October 21, 2026 09:37
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