It Started With Csrf But Wait Xss Potential Sqli
The email update endpoint trusted a username value stored in a cookie, allowing an attacker to change another user's email address without authentication. The email field also reflected a script payload, leading to reflected cross-site scripting.
It’s been a while since I last posted, so I’m back with a write-up of a CSRF lab from the TCM Bug Bounty Course.
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 application trusted a user-controlled cookie value to identify the account being modified, and failed to sanitise the email input before reflecting it.
Impact
An attacker could take over another user's account by changing their email and then resetting the password; the email field also allowed reflected cross-site scripting.
What the attacker needed
A free account; victim clicks a link
How it was found
- Log in as Jeremy and intercept the email update request.
- Change the username in the cookie from Jeremy to Jessamy.
- Send the request and observe that Jessamy's email is updated without logging in as her.
- Enter a script payload in the email field and observe a reflected response.
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 used a cookie to decide which user's email to update, instead of checking who was logged in. By changing the cookie value, an attacker could update someone else's email and then take over their account. The email field also echoed back a script, which could run in a victim's browser.
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.