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.
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.
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
- Create an account on the subdomain and reach the avatar/profile picture upload step.
- Upload a file with an .svg.html extension containing script, and observe it is accepted and saved.
- Inspect the page in the browser's developer tools to find the stored file's URL path.
- 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.