Unhiding the hidden 401 Bypass
The front nginx server blocked access to certain administrative paths with a 401 response, but the backend server processed X-Rewrite-Url and X-Original-Url headers, allowing an unauthenticated attacker to bypass the restriction and access internal administrator functions such as viewing users, projects, logs, and access tokens.
Greetings, hackers! I am Pushkar a Security researcher from India, and I am excited to share to present my discovery.
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 front nginx server enforced access control on the original request path but did not strip or validate the X-Rewrite-Url and X-Original-Url headers, which the backend server then used to route the request to a protected path.
What the attacker needed
None
How it was found
- Send a request to a protected path such as /application-tokens as an unauthenticated user.
- Observe that the front nginx server returns 401 Unauthorized.
- Add an X-Rewrite-Url or X-Original-Url header set to / to the request.
- The backend server processes the header and the request bypasses the front server restriction, granting access to forbidden files and directories.
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.
A web server often has a front door (like nginx) that checks if you are allowed in, and a back room (the application) that does the real work. Here, the front door said 'no' (401 Unauthorized), but the back room trusted special instructions in the request headers (X-Rewrite-Url or X-Original-Url) that told it to go to a different path. Because the front door did not check those headers, an attacker could sneak past the check and reach admin-only pages without logging 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.