Skip to content
XSS Write-up Beginner

Stored XSS via SVG File Upload in a Project Management Applicatio

A project management application accepted SVG file uploads without sanitisation and served them from the same origin, so an attacker could upload an SVG containing an onload handler that executed JavaScript in the browser of any user who viewed the file. This allowed session hijacking, account takeover, phishing, and data exfiltration.

0xPinocchioSec Follow

Published on medium.com

During one of my bug bounty hunting sessions, I came across a Stored Cross-Site Scripting (XSS) vulnerability in a project management web application. The vulnerability was triggered through a file upload feature that allowed SVG files without proper sanitization.

0xPinocchioSec, 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

Root cause

Likely the application failed to validate or sanitise uploaded SVG files and served them from the same origin without a Content Security Policy, allowing embedded JavaScript to execute.

Impact

An attacker could steal session cookies, take over accounts, conduct phishing, deliver malware, or exfiltrate data from any user who viewed the uploaded SVG, as it executed in the application's origin.

What the attacker needed

A free account; victim opens the uploaded SVG

The fix

The application should sanitise SVG content, serve uploads from a separate domain, implement a strong Content Security Policy, restrict allowed file types, and validate file content by MIME type.

How it was found

  1. Create an SVG file with an onload event handler that runs JavaScript.
  2. Upload the SVG file through the file attachment field in the Create Project form.
  3. Navigate to the uploaded SVG file within the application.
  4. Observe that the JavaScript executes in the application's origin.

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 people upload SVG files, which are not just pictures but can contain code. Because the uploaded file was shown from the same website address, that code ran in the victim's browser as if it were part of the site. This meant an attacker could steal cookies or take over accounts just by getting someone to open the file.

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.