SSRF follow-up: pin the socket to the validated IP (DNS rebinding / TOCTOU)

Open
#207 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #366 by @Frankie-Xu — closed without merging

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
security

Research direction

Start by reading issue #206 and the fetch-tier implementations, especially the HTTP client dispatcher and the TLS-impersonation and browser connection paths. Determine whether each stack exposes a way to connect to the already-validated IP; implement pinning for the HTTP tier first, then assess the other tiers. The browser tier may need a local validating proxy or an explicitly documented residual; keep the #206 re-check as the baseline.

Written by the indexing model from the issue text.

Description

area:fetch enhancement

Follow-up to #206. That issue closes the static-record bypass with a resolve-and-validate re-check at every fetch seam. This one tracks the remaining TOCTOU gap: pinning the socket to the IP we already validated.

The gap: even after we resolve a host and validate every returned IP, the real connection resolves DNS again at connect time. An attacker who controls the authoritative resolver can return a public IP for the check and flip to 169.254.169.254 or an RFC-1918 host for the connect, inside the TTL window. That is classic DNS rebinding. The only airtight fix is to make the socket connect to the exact IP we validated instead of re-resolving.

Feasibility is uneven across our fetch tiers, which is why this is a separate, phased issue rather than part of #206:

  1. HTTP client tier. Pinnable cleanly with a lookup/connect hook on the dispatcher, so the socket uses the validated IP and never re-resolves. Highest value, do this first.
  2. TLS-impersonation tier. Depends on whether that stack exposes a connect or lookup hook. If it does, mirror the HTTP-tier approach; if not, record the residual.
  3. Browser tier. Effectively unpinnable, since the browser does its own DNS and we don't control its socket layer. Options are pre-nav resolve-and-validate (check only, does not close rebinding) or routing through a local validating proxy. Whatever we pick, document the residual honestly rather than implying the browser tier is rebinding-safe.

Scope: pin the HTTP client tier first (small, high value), then the TLS tier if its stack allows, then decide the browser tier (proxy vs documented residual). The resolved-IP re-check from #206 stays as the floor everywhere, so even the unpinned tiers still block the static-record case.

Depends on #206 landing first, since the re-check is what produces the validated-IP set to pin to.

@spartan8806 flagging you, since you called this out in #206 and offered to take the pinning follow-up. No pressure to own it, but it's yours if you want it. Same phasing applies: HTTP tier first.

Dominant language
TypeScript
Stars
5.4k
Forks
445
Avg merge
20h 41m
Merged PRs (30d)
85

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from KnockOutEZ/wigolo

All issues in KnockOutEZ/wigolo

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.