Skip to content
XSS Write-up Beginner

XSS | HTML Injection and File Upload Bypass in HUAWEI Subdomain

A subdomain's avatar upload accepted an SVG/HTML file containing script, and the uploaded file was served back from a predictable path so the script executed in the browser. An attacker could upload a crafted file and get stored script to run for anyone who opened the file's URL.

Ahmed Hassan Follow

Published on medium.com

I started to enumerate all Subdomains of Huawei. But after searching a lot i did not find any low hanging fruits.

Ahmed Hassan (Bishoo97x), 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 upload feature validated files by extension or content type only loosely, and stored files were served from the same origin without forcing a safe content type or download.

Impact

Stored script could run in the origin when a victim opens the uploaded file's URL, and the tester also reports that HTML and PHP files were accepted and executed.

What the attacker needed

A free account; victim opens the uploaded file URL

The fix

The upload should be restricted to real image types, re-encoded server-side, and served with a safe content type and download disposition from a separate origin.

How it was found

  1. Create an account on the subdomain and reach the avatar/profile picture upload step.
  2. Upload a file with an .svg.html extension containing script, and observe it is accepted and saved.
  3. Inspect the page in the browser's developer tools to find the stored file's URL path.
  4. Open that path in a new tab and see the script execute.

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 let people upload a profile picture, but it did not check the file type properly. The tester uploaded a file that was really a web page with a small script inside, and the site saved it and served it back as a normal page. When the file's address is opened in a browser, the script runs, which is called cross-site scripting (XSS): running someone else's code in a victim's browser.

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 Ahmed Hassan

View all

4 more disclosed reports, best first.

More from Huawei

View all

The newest disclosed reports for this program.

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.