403 Forbidden Bypass Exposing API Key
A 403 Forbidden restriction on an API documentation endpoint could be bypassed by URL-encoding the path, revealing a secret API key in the response. An attacker could use this key to access the third-party service, though the report does not demonstrate misuse.
Published on medium.com
This report outlines the discovery and exploitation of a vulnerability on redacted.com. I have to keep the company name private due to a NDA.
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 access control check was applied to the decoded path but not to the encoded variant, allowing a bypass.
Impact
An attacker could obtain the exposed API key and potentially use it to access the third-party service, though the report does not show any actual misuse.
What the attacker needed
None
The fix
The access control should be enforced consistently on the normalised path so that encoded variants cannot bypass the 403 restriction.
How it was found
- Access the endpoint /API/V2/ and remove the /v2/ segment to reach an API documentation page.
- Observe that the documentation page returns a 403 Forbidden status.
- URL-encode the endpoint and request it again.
- The 403 is bypassed and the API documentation is returned.
- Inspect the response and find a secret API key.
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 website sometimes blocks access to certain pages with a '403 Forbidden' error. The researcher found that by changing the way the address was written (using URL encoding, which replaces characters with codes), the block could be skipped. The page then showed a secret key that should have been hidden, which could let someone use a service without permission.
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.