Html Injection Via User Agent Leads To Website Distortion Revealing Backend Code
The User-Agent header value was reflected into the page without proper encoding, allowing HTML injection. An attacker could distort the website and reveal backend code.
Published on infosecwriteups.com
This is my 3rd writeup about an HTML INJECTION occurring at the User-Agent header which leads to website page distortion and revealing backend code.
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 inserted the User-Agent header into the HTML response without encoding it.
Impact
An attacker could distort the website and reveal backend code; XSS was blocked, so the impact was limited to HTML injection.
What the attacker needed
Ability to set a custom User-Agent header
How it was found
- Capture a request to the main target page.
- Notice that the User-Agent value is reflected in the response.
- Craft a payload with HTML tags in the User-Agent header.
- Send the request and observe the page distortion and backend code exposure.
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 a website shows back what you send it, like your browser's User-Agent string, it must treat that text as plain text, not as code. Here it didn't, so special HTML tags in the User-Agent were treated as part of the page, changing how the page looked and exposing some server-side code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.