Web security · Walkthrough
Finding IP Allow-List Bypasses via X-Forwarded-For Spoofing
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
- Identify IP-gated behavior: Look for endpoints returning 403/401 based on location, internal/corporate network assumptions, or rate-limit tiers.
- Test header precedence: Send requests with spoofed
X-Forwarded-For(and related forwarding headers) to observe whether the app trusts client input over the actual network peer IP. - Demonstrate real impact: Show unauthorized access, rate-limit circumvention, or policy bypass with clean, reproducible HTTP requests while staying strictly within authorized scope.
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
- 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.
- 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.
- Test edge cases across proxies and CDNs: Verify behavior behind load balancers and CDNs so spoofed headers cannot slip past filters.
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 →