Many web apps let visitors choose their own IP address

· · Security Infrastructure

Your web app probably makes decisions based on where a visitor is connecting from. The login page allows a handful of password attempts per address before it slows down. The admin area only opens from the office network. The audit log records the address behind every change. All three assume the app knows the visitor's real IP address, the internet address their connection comes from. Behind a load balancer or a CDN, it often only knows what it has been told, and new research shows some popular frameworks will believe the visitor.

How your app finds out who is visiting

Most business web apps sit behind a load balancer, a reverse proxy such as Nginx, or a CDN (content delivery network, a service like Cloudflare that serves your site from locations close to your visitors). We will call all of these the proxy. Every request your app sees arrives from the proxy, so the proxy adds a note to it, a header, saying who the real visitor was.

The common note is X-Forwarded-For: unofficial, but almost every proxy writes it and almost every framework reads it. There is also a newer, standardised header simply called Forwarded, which does the same job. Hardly anything uses it.

That gap is the problem. On 5 November, security researcher Lauri Koskela published research showing that some frameworks read Forwarded and prefer it over X-Forwarded-For, while the proxies in front of them ignore Forwarded and pass it along untouched. A visitor adds their own Forwarded header claiming any address they like, the proxy forwards it, and the app takes the visitor's word over the proxy's.

Who is affected

The research tested frameworks with forwarded-header support switched on, as their documentation tells you to when running behind a proxy.

  • Ruby on Rails 8.1.0 to 8.1.4. A change in 8.1 started reading Forwarded, and Rails's built-in check for conflicting headers missed it. Rails fixed this in 8.1.4.1, released on 4 November, as CVE-2026-126083, rated High. The Rails advisory notes that Rails's built-in rate limiting counts by this address by default. It also notes the fix only catches a fake when your proxy sets X-Forwarded-For as well. Rails 8.0 is not affected, and nor are apps still on Rack 2.
  • Jetty, the Java web server. It has read Forwarded by default alongside X-Forwarded-For for years, and prefers it. The project added settings to control this but kept the default.
  • Spring Boot before 4.2, when forwarded-header handling is on and the app runs on Jetty, Reactor Netty, or Spring's own header filter. Tomcat, Spring Boot's usual default server, reads only one kind of header at a time and is not caught out this way. Spring Boot 4.2, still at release candidate stage, reads only X-Forwarded headers by default. Older versions gained a setting to choose, but you have to opt in.
  • Symfony reads Forwarded only if you enable it, and rejects requests where the two headers disagree. If enabled, the host name can still be faked.

Meanwhile the proxies tested (Nginx, Apache, Caddy, Traefik, Envoy, and Kong) all pass Forwarded straight through. HAProxy handles it only if configured to. Going by their documentation, Cloudflare and Amazon CloudFront also leave it alone.

What a fake address gets an attacker

Unlimited login attempts. If the rate limit counts by address, a new fake address on every request means the limit never triggers.

A way past office-only pages. An admin area that only opens for the office's address opens for anyone who claims to be the office.

Logs you cannot trust. The researcher found one live site where his fake address landed in a log shown to administrators. After an incident, a record of what visitors claimed is not evidence.

Password reset links that point elsewhere. On Jetty, Spring, and Symfony, Forwarded can also change the site name the app thinks it is serving. Apps that build reset links from that name can be tricked into emailing a real user a link to the attacker's site, handing over the reset token.

Why "trusted proxies" is not enough

Most frameworks have a trusted-proxies setting: only believe forwarding headers when the request comes from your own proxy. Keep it. It stops anyone who reaches your app directly from faking headers. It does not help here, because the bad header does come from your proxy, which passed it on without looking. A trusted proxy is only trustworthy if it removes or rewrites every header your app trusts it to set.

What to do

Know which headers your proxy sets. For most setups that is X-Forwarded-For, plus X-Forwarded-Proto and sometimes X-Forwarded-Host. Almost certainly not Forwarded.

Make the app read only those. The researcher's short answer: turn off Forwarded support in your app. In Rails, the advisory gives a one-line setting that tells Rack, the layer under Rails, to ignore Forwarded entirely. On Spring Boot and Jetty, choose the X-Forwarded format explicitly rather than relying on the default. Upgrade Rails to 8.1.4.1 either way.

Strip forwarding headers at the edge. Configure the first proxy a visitor reaches to drop any incoming Forwarded header and overwrite the X-Forwarded ones. Headers the visitor sends should never reach the app.

Fix the allowed site names. Symfony, Django, and ASP.NET Core can reject requests for any site name not on an allowed list. That blocks the reset-link trick even if a fake name slips through.

Test it. Against your own site, send a request with a made-up header, for example curl -H "Forwarded: for=203.0.113.7" https://yoursite.example/, and check which address your app logs. If it logs 203.0.113.7, the app is believing the visitor. On Jetty, Spring, and Symfony, the researcher found a second tell: Forwarded: host=example.com:invalidport returns a 400 error if the app is reading the header at all.

If an agency built your app, forward them this and ask:

  • Which framework and version is it, and is forwarded-header support switched on?
  • Which headers does our proxy, load balancer, or CDN set, and does it remove the ones visitors send?
  • Have you sent a forged Forwarded header and checked what the app logs?

How Steelwise can help

Checking that your proxy and your app agree on who the visitor is, and that the answer survives a deliberately forged request, is the kind of architecture review we do for software teams. Get in touch.

Further reading

← All filings