Web security · Walkthrough

Finding IP Allow-List Bypasses via X-Forwarded-For Spoofing

Nazeer Ahmed By Nazeer Ahmed · TrendCatcher

IP allow-lists are commonly used to restrict sensitive endpoints, internal tools, rate-limit exemptions, or geo-gated features to trusted networks. When application code or middleware determines the client’s IP address from an untrusted HTTP header such as X-Forwarded-For (XFF) instead of the verified socket/proxy connection, an attacker can spoof an allowed IP address and bypass the restriction.

How the Bypass Happens

Reverse proxies and CDNs often append client IP addresses to X-Forwarded-For. Problems arise when an application reads the leftmost entry, trusts any client-supplied X-Forwarded-For header directly, or applies allow-list checks after parsing a header that external clients can control.

GET /admin-or-restricted-endpoint HTTP/1.1
Host: target.example.com
X-Forwarded-For: 127.0.0.1

Severity & Triage Context

Not every X-Forwarded-For spoofing behavior carries the same severity. Triagers look closely at what the IP restriction actually protects: bypassing authentication or exposing sensitive admin/customer data has far higher impact than spoofing a display label or a low-impact cosmetic check.

A security control is only as strong as the identity source it trusts—HTTP headers sent by the client are user-controlled input until validated by a trusted proxy boundary.

How to Fix It Properly

  1. Determine client IP from trusted proxy metadata: Configure your web server, reverse proxy, or framework so only explicitly trusted proxy hops populate client IP context, and ignore unverified client headers.
  2. Enforce strong authentication and authorization: Never rely on IP allow-listing alone to protect sensitive actions or data—pair it with proper session/token authentication and role checks.
  3. Test edge cases across proxies and CDNs: Verify behavior behind load balancers and CDNs so spoofed headers cannot slip past filters.
Web Security Access Control Bug Bounty HTTP Headers

Want an independent review of your access controls and APIs? TrendCatcher offers fixed-price web app, API, and sign-in security testing with clear reproduction evidence and a free 30-day retest. Book a test →