Skip to content
XSS Write-up Beginner

I Turned a “What’s Your Name?” Field Into a Malicious Link — My First HTML Injection

A webpage's name input field inserted user text directly into the page's HTML without sanitisation, so the browser rendered it as markup. An attacker could enter HTML that creates a clickable link to a site they control, enabling phishing or defacement.

rajprashantwork Follow

Published on medium.com

Every website you’ve ever visited is built on the same three foundations: HTML, CSS, and JavaScript. Understanding how these work together isn’t just useful for developers — it’s essential for security researchers, because almost every web vulnerability exists at the intersection of these technologies and human error.

Prashant Raj, on 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 inserted user-supplied text into the page's HTML without sanitising or encoding it, so the browser parsed it as markup.

Impact

An attacker could place a fake link on the page that leads to a phishing site, deface the page, or, if combined with JavaScript injection, escalate to cross-site scripting that could steal cookies or session tokens.

What the attacker needed

Access to the name input field

The fix

The application should sanitise and encode user input before displaying it, so it is shown as text rather than interpreted as HTML.

How it was found

  1. Open the page with the 'What's your name?' input field.
  2. Type HTML markup into the field instead of a normal name.
  3. Submit the form and observe the page render the input as a clickable link.

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 website should treat anything you type into a form as plain text, not as instructions for the browser. Here, the page pasted the typed name straight into its own code, so the browser followed it as if the site's own developer had written it. That let the author make a working link to another site appear on the page.

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.