Skip to content
XSS Write-up Beginner

Unveiling a Cross-Site Scripting (XSS) Vulnerability in the Chatb

A chatbot page stored user input without sanitisation or encoding, so an attacker could inject a script with an onmouseover handler that executed when a victim hovered over the displayed text. This could let the attacker steal cookies or session tokens and hijack the victim's session.

Ajay Yadav Follow

Published on yadav-ajay.medium.com

In today's digital landscape, web security is more critical than ever. As applications become more interactive and dynamic, vulnerabilities can creep in, posing significant risks to users and organizations.

Ajay Yadav, on yadav-ajay.medium.com

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 stored user-supplied input and rendered it back into the page without output encoding or sanitisation, allowing an event-handler attribute to execute.

Impact

An attacker could steal cookies or session tokens, hijack a user's session, deface the page, or redirect users to malicious sites, though the report does not show these actions actually being carried out.

What the attacker needed

Access to the chatbot page; victim hovers over the stored text

The fix

The application should validate input on the server side and encode output before rendering it, and it should add a Content Security Policy; the text does not say whether this was fixed.

How it was found

  1. Open the chatbot question page.
  2. Click a predefined question and wait for the answer.
  3. Click the magnifying glass icon to reveal an input field.
  4. Enter a payload containing an onmouseover event handler.
  5. Submit the input and observe it is saved and displayed.
  6. Move the mouse over the displayed text and see the popup 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.

Cross-site scripting (XSS) is when a website takes text from a user and later shows it to other people without making it safe, so the text can contain code that runs in their browser. Here, a comment or feedback field saved whatever was typed and displayed it as part of the page. When someone moved their mouse over the saved text, the hidden code ran and showed a popup, which proves an attacker could run their own 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.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.