Enumerating IPs in X-Forwarded-Headers to bypass 403 restrictions
The author describes how IP-based access restrictions, such as those in .htaccess files, can be bypassed by spoofing the X-Forwarded-For header with a whitelisted IP address. An attacker could gain unauthorised access to protected directories like /wp-admin/.
Published on shubs.io
June 15 2015 · websec security tool
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
Likely the server trusts the client-supplied X-Forwarded-For header to determine the client's IP address for access control decisions, without properly validating or stripping it.
Impact
An attacker could bypass IP-based restrictions and gain unauthorised access to protected areas, potentially leading to full administration access.
What the attacker needed
IP-based access control in use; Attacker can send custom headers
The fix
The server should not rely on client-supplied headers for access control; instead, it should use the actual connecting IP or properly validate and strip X-Forwarded-For headers at the edge.
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.
Some websites try to restrict access to certain pages based on the visitor's IP address, which is like a phone number for a computer. The X-Forwarded-For header is a way for proxies to tell the server the original IP, but it can be faked. If the server trusts this header without checking, an attacker can pretend to be from an allowed IP and get 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.