Broken Access Control & Stored XSS - Easy Hunt
A low-privilege admin could change the privileges of a high-privilege account by altering a user identifier in the request, and a stored cross-site scripting flaw existed in the user name field because the value was inserted into a script without proper encoding. An attacker could escalate privileges and run script in other users' browsers.
Hello everyone, This is my second blog post and today I'll be sharing my methods of how I was able to hunt an sXSS in a private program. This was a very clean catch so without wasting any more time let's get to the methodology.
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 server trusted a user-supplied identifier for privilege changes without checking the caller's rights, and the profile name was inserted into a script context without correct encoding.
Impact
A low-privilege admin could escalate another account's privileges, and stored script could run in the browser of anyone viewing the affected user page.
What the attacker needed
A low-privilege admin account; a high-privilege account identifier; victim views the affected user page
How it was found
- Log in with a low-privilege admin account and a high-privilege admin account.
- Capture the request used to modify user privileges.
- Take a high-privilege account's user identifier and change the modifyUserId parameter in the low-privilege request.
- Send the request and observe that the high-privilege account's privileges were changed.
- Update a user's profile name with a value that escapes the script context and includes script tags.
- Visit the User tab and observe the stored script executing.
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.
The app let a less powerful admin change settings for a more powerful account just by changing a number in the request. Separately, the name field was placed into a script on the page without being made safe, so a crafted name could run code in a visitor's browser. This is called stored cross-site scripting because the harmful value is saved and shown to others later.
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.