Skip to content
XSS Write-up Beginner

Html-Injection [ Bug Bounty ]

A search field on a deliberately vulnerable demo site echoed user input back into the page without encoding it, so injected HTML tags were rendered by the browser. An attacker could use this to place their own content, such as a styled heading, inside the page.

rhashibur75 Follow

Published on medium.com

I’ll be using a demo website for testing purposes: http://testphp.vulnweb.com/

Kazi Hashibur Rahman, 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 search input was reflected into the page without HTML encoding, so the browser interpreted the typed tags as markup.

Impact

An attacker could inject HTML content into the page, though the text does not show any script execution or harm beyond altered display.

What the attacker needed

A search field that echoes input; none

The fix

Input should be validated and HTML special characters encoded before display, with a Content Security Policy as an extra layer.

How it was found

  1. Open the target site.
  2. Type an HTML heading tag into the search field.
  3. Submit the search.
  4. Observe that the heading text appears in the chosen colour, showing the tag was rendered.

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.

Web pages are built from HTML, the language that says what text, headings and boxes appear on screen. If a site takes what you type and puts it straight into the page without cleaning it, your text can be treated as page instructions rather than plain words. Here, typing a heading tag made the site display a blue heading, which shows the input was not cleaned.

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.