Reflected Xss User Agent
The application reflects the User-Agent header value into the response without sanitisation, allowing an attacker to inject script that executes in the victim's browser. An attacker could craft a request with a malicious User-Agent to achieve reflected cross-site scripting.
Hello friends, today I will show you the steps of detecting a vulnerability that I encountered in Web Application Security Tests in my project named Saka Reflected XSS (User Agent) and exploiting this vulnerability.
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
The application reflects the User-Agent header value into the response without any output encoding or validation.
Impact
An attacker could execute arbitrary script in a victim's browser by crafting a request with a malicious User-Agent header, potentially leading to session theft or other client-side attacks.
What the attacker needed
Victim sends a request with attacker-controlled User-Agent
How it was found
- Open the application and press the Attack button to reach the test page.
- Observe that the page displays browser and computer information taken from the User-Agent header.
- Modify the User-Agent header in the request to include characters that the browser will interpret as code.
- Send the request and confirm that the response reflects the modified User-Agent without sanitisation.
- Observe that the injected code executes in the browser, demonstrating reflected XSS.
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.
When you visit a website, your browser sends a 'User-Agent' header that identifies your browser and computer. This website takes that header and puts it directly into the page it sends back, without cleaning it. If an attacker changes their User-Agent to include code, the website will send that code back and the browser will run it, which is called cross-site scripting (XSS).
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.