Header Hijinks: How X-Forwarded-For Gave Me Internal Access
An internal portal was protected only by IP-based access control that trusted the X-Forwarded-For header. By setting that header to [redacted], an attacker could access the internal dashboard and sensitive user data without authentication.
medium.com
Published on medium.com
Free Link π
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application blindly trusted the X-Forwarded-For header to determine the client's IP address without verifying it came from a trusted proxy.
Impact
The attacker could view internal dashboards, access user email logs, download support tickets, and read private chat logs without authentication.
What the attacker needed
Knowledge of internal subdomain; ability to send custom HTTP headers
The fix
The application should only trust X-Forwarded-For when it comes from a verified reverse proxy and should not rely solely on IP-based access control.
How it was found
- Find the internal subdomain via subdomain enumeration.
- Send a request with X-Forwarded-For set to 127.0.0.1.
- Receive a 200 OK and access the internal dashboard.
- Access sensitive endpoints like /api/download-logs with the spoofed header.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The website tried to keep people out by checking their IP address, but it believed a header that anyone can set. By claiming to be from the local machine, the attacker tricked the site into letting them in.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.