HTML Injection Bug Bounty: How I Found a Persistent Vulnerability
The chatbot on a government portal rendered user-supplied HTML without sanitisation, allowing an attacker to inject formatting and a script that executed despite filters. This could enable content spoofing and phishing, such as a fake login form, on a trusted domain.
Published on vanshrathorebughunter.medium.com
The original lives on vanshrathorebughunter.medium.com
We do not hold its text, 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 chatbot echoed user input into the page without HTML-encoding or sanitising it, so markup was rendered as active content.
Impact
An attacker could inject a fake login form or error overlay into the trusted chat window to harvest credentials, and because it is on the legitimate domain, standard anti-phishing filters would not flag it.
What the attacker needed
Access to the chatbot interface; victim views the injected chat content
The fix
The chatbot should HTML-encode all user input before rendering it and enforce a strict Content Security Policy.
How it was found
- Open the customer support chatbot on the government portal.
- Send a message containing harmless HTML formatting tags.
- Observe that the chatbot renders the tags as formatted text instead of plain text.
- Send a message containing a script payload to test execution.
- Observe that the script executes and can manipulate the chat window.
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 chatbot on a government website displayed whatever HTML a user typed instead of showing it as plain text. HTML is the code that tells a browser how to show bold, links, or forms. Because the site trusted that code, an attacker could make the chat window show a fake login box or error message that looked official.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.