When the Lock Comes With the Key: Bypassing Client-Side Encryptio
The application encrypted a tenant organisation identifier in a request header using a key derived from the user's own JWT, all inside the browser. Because the client held both the logic and the key, an authenticated user could re-encrypt a different organisation identifier and the backend returned another tenant's data.
Hello world, this write-up covers an interesting IDOR vulnerability I discovered during a web application security assessment. What made this finding interesting was not just the access control issue itself, but the way the object identifier was handled and the approach used to manipulate it.
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 backend trusted a client-supplied organisation identifier and treated client-side encryption as an access control, instead of deriving the tenant from the authenticated session.
Impact
An authenticated user could read data belonging to other organisations on the same platform, breaking tenant isolation.
What the attacker needed
An authenticated account; ability to run a script in the browser
The fix
The backend should derive the organisation from the authenticated session and check authorisation on every request, rather than trusting a client-supplied identifier.
How it was found
- Review the requests and notice an unreadable Org_id header sent on multiple requests.
- Observe that the value is not returned by the API but appears after login and is added by the client.
- Search the JavaScript files for the Org_id handling and encryption logic.
- Find that the value is AES-CBC encrypted with a key derived from the user's JWT.
- Recreate the encryption logic in a script and decrypt the header to a numeric organisation identifier.
- Change the identifier, re-encrypt it, replace the header and send the request.
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 stored a number identifying your organisation in a request header, but scrambled it first so it looked unreadable. The scrambling happened in your own browser, so anyone could unscramble it, change the number and scramble it again. The server never checked whether you were allowed to see that other organisation's data, so it simply handed it over.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.