Skip to content
XSS Write-up Intermediate

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.

Ahmad Halabi Follow

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:

Ahmad Halabi, on ahmdhalabi.medium.com

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

  1. An admin or manager creates a loan and invites an employee to finalise it.
  2. The employee enters a script payload in the purchase description field of the loan.
  3. The employee invites the manager to view and approve the loan.
  4. When the manager opens the loan, the stored script runs in the manager's browser.
  5. The script reads the manager's CSRF token and sends a request that changes the employee's role to manager.
  6. 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.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.