From Blind XSS to RCE: When Headers Became My Terminal
A blind XSS payload stored in profile fields was executed by an admin, allowing the attacker to steal the admin's session cookie and access the admin panel. The attacker then uploaded a PHP web shell that executed commands passed via the Accept-Language header, achieving remote code execution.
I’m Mahmoud Elmanzalawy, a bug bounty hunter who enjoys finding vulnerabilities in his free time. Today, I’ll walk you through how a simple Blind XSS led me all the way to Remote Code Execution (RCE) , and how HTTP headers became my terminal
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 sanitise user-supplied profile fields before rendering them in the admin panel, and the file upload feature allowed executable PHP files to be uploaded and run.
What the attacker needed
Ability to set profile fields; admin visits user settings; admin panel file upload feature
How it was found
- Inject an XSS payload into profile fields such as username and bio.
- Replace the payload with one that loads an external script to capture cookies.
- Send a message to the admin via the contact form to encourage them to visit the user settings page.
- Use the stolen admin cookie to access the admin panel.
- Upload a PHP file that executes commands from the Accept-Language header.
- Send a request with a custom Accept-Language header containing a system command to execute it.
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 attacker put a small script into their profile that ran when an administrator viewed it, letting them steal the admin's login cookie and take over the admin panel. From there they uploaded a malicious file that let them run commands on the server by hiding them in a normal web request header.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.