Skip to content
XSS Write-up Intermediate

Beyond the Popup: Turning Stored XSS into Remote Code Execution

A stored XSS vulnerability in SVG profile picture uploads allowed an attacker to execute JavaScript in an admin's browser. By chaining this with a command execution feature that lacked CSRF tokens but was protected by SameSite cookies, the attacker could run system commands with admin privileges.

ramshath1999 Follow

Published on medium.com

That’s exactly what happened during a recent assessment where a simple SVG file upload led to Remote Code Execution (RCE). In this post, I’ll walk you through the unexpected vulnerability chain that escalated from a minor stored XSS to complete system compromise.

Ramshath, on 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

Impact

An attacker could execute arbitrary system commands with admin privileges, leading to full system compromise.

What the attacker needed

Ability to upload profile picture; admin views the profile; command execution feature exists

The fix

The application should sanitise SVG uploads, implement CSRF tokens, restrict high-privileged functions, and enforce a strong CSP.

How it was found

  1. Upload an SVG file containing a script to the profile picture feature.
  2. Confirm the script executes when the profile is viewed.
  3. Craft a payload that sends a request to the command execution endpoint.
  4. Base64-encode the payload to bypass XML parsing issues and filters.
  5. Deliver the malicious SVG to an admin (e.g., by having them view the profile).
  6. The admin's browser executes the payload, running the command with admin privileges.

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 application let users upload profile pictures, and it accepted SVG files without properly checking them. An attacker could upload an SVG containing JavaScript, which would run when an admin viewed the profile. The attacker then used that JavaScript to make the admin's browser send commands to a feature that runs system commands, achieving remote code execution.

What is XSS?

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

More by ramshath1999

View all

2 more disclosed reports, best first.

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.