Skip to content

fix: re-land SSRF DNS pinning to prevent TOCTOU rebinding attacks#1681

Merged
houko merged 1 commit into
mainfrom
fix/ssrf-dns-pin-reland
Mar 25, 2026
Merged

fix: re-land SSRF DNS pinning to prevent TOCTOU rebinding attacks#1681
houko merged 1 commit into
mainfrom
fix/ssrf-dns-pin-reland

Conversation

@houko
Copy link
Copy Markdown
Contributor

@houko houko commented Mar 25, 2026

Summary

PR #1653 was merged but the code never landed on main. This re-implements:

  • check_ssrf() returns resolved IPs, caller pins DNS via reqwest .resolve()
  • is_ssrf_target() in host_functions.rs does the same for WASM sandbox path
  • DNS resolution failure → BLOCKED (fixes silent pass-through)
  • Remove dead client field from WebFetchEngine

Test plan

  • Web fetch to public URLs works
  • Private/loopback IPs blocked even with DNS rebinding
  • DNS failure blocks request instead of passing through

The previous DNS pinning fix (PR #1653) was merged but the code never
landed on main. This re-implements the same fixes:

- check_ssrf() now returns SsrfResolution with resolved IPs instead of ()
- WebFetchEngine builds a per-request DNS-pinned client via reqwest
  .resolve() so the HTTP stack connects only to validated IPs
- is_ssrf_target() in host_functions.rs returns SsrfResolved and
  host_net_fetch() pins DNS on the WASM sandbox path too
- DNS resolution failure is now treated as BLOCKED (fixes the silent
  pass-through `if let Ok(addrs)` pattern)
- Remove dead `client` field from WebFetchEngine (was #1678)
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@houko houko merged commit ed8f9f1 into main Mar 25, 2026
10 of 13 checks passed
@houko houko deleted the fix/ssrf-dns-pin-reland branch March 25, 2026 15:31
@github-actions github-actions Bot added the area/runtime Agent loop, LLM drivers, WASM sandbox label Mar 25, 2026
@houko houko mentioned this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/runtime Agent loop, LLM drivers, WASM sandbox

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant