LFI to ATO (Universal )
An IDOR in a company details API endpoint allowed reading other users' data, and a path traversal in an image upload URL allowed reading backend source code, which exposed a weak JWT signing secret. An attacker could chain these to forge tokens and take over any account.
medium.com
Published on medium.com
Long time no see cyber-warriors, hope you are doing well, and will like this write-up.
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 API endpoint lacked proper authorization checks (IDOR) and the file path was not sanitised, allowing directory traversal to read source code that contained a hardcoded weak JWT secret.
Impact
An attacker could read other users' details and, by chaining with the LFI to obtain the JWT secret, forge tokens to take over any account.
What the attacker needed
A user account; ability to upload a profile image; knowledge of victim's user_id and email (from IDOR)
How it was found
- Capture the PUT request to /api/company/{user_id} and change it to GET.
- Change the user_id to another user's ID (e.g., decrement by one) to retrieve their details.
- Upload a company profile image and note the URL containing a path.
- Modify the path with ..%2f to traverse directories and read files like index.js.
- Search the source code for the JWT signing secret.
- Forge a JWT with the victim's user_id and email using the secret, then set it in localStorage to log in as the victim.
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.
This report describes two mistakes in a web app. First, a user could change a number in a web address to see other people's company details. Second, by putting special characters in an image URL, the user could read files on the server, including the secret key used to create login tokens. With that key, the attacker could make a valid login token for any user and log in as them.
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.