Stored XSS to Privilege Escalation to Admin Takeover to Data Brea
A stored cross-site scripting flaw in a loan application's purchase description field let a low-privileged employee run script in a manager's browser. The attacker used this to steal the manager's CSRF token and change their own role to manager, then reach super admin and customer data.
Published on ahmdhalabi.medium.com
It’s been a while since I published a write-up. Over the course of two dedicated years in bug bounty, I earned over 15,000 reputation points, ethically hacked 250+ programs, and achieved several notable rankings:
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 purchase description input was saved and later rendered without sanitisation, so script supplied by one user executed in another user's session.
Impact
The attacker could escalate to manager and super admin, remove existing admins, control loan operations and dump customer data, which the author says could lead to data being sold and reputational and financial damage.
What the attacker needed
An employee account on the loan platform; a manager views the malicious loan; attacker hosts a script on their own server
How it was found
- An admin or manager creates a loan and invites an employee to finalise it.
- The employee enters a script payload in the purchase description field of the loan.
- The employee invites the manager to view and approve the loan.
- When the manager opens the loan, the stored script runs in the manager's browser.
- The script reads the manager's CSRF token and sends a request that changes the employee's role to manager.
- The employee now has manager or admin access and can view all loans and customer data.
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.
Stored cross-site scripting means text a user saves is later shown to someone else without being made safe, so any script hidden in it runs in that other person's browser. Here an employee put a script into a loan description, and when the manager opened the loan the script ran as the manager. Because the site trusted requests coming from the manager's browser, the script could quietly change the employee's role to manager.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.