Skip to content
XSS Write-up Beginner

Hex Encoding in XSS: A Sneaky Bypass Story

The application reflected user input without proper sanitisation, escaping angle brackets but not hex-encoded characters. An attacker could inject a hex-encoded script that the browser decoded and executed, leading to XSS.

medium.com

Published on medium.com

👋 Hola Hackers! We are DhruxMan, passionate cybersecurity enthusiast who love exploring the world of ethical hacking.

DhruxMan, 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

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to session hijacking, phishing, data exfiltration, or drive-by downloads.

What the attacker needed

Victim visits a crafted URL or page; input field reflects user input

The fix

The application should validate input against a whitelist and apply context-aware output encoding, and it should also enforce a strong Content Security Policy.

How it was found

  1. Identify that user input is reflected on the page without proper sanitisation.
  2. Notice that the application escapes < and > but does not handle hex-encoded characters.
  3. Submit a hex-encoded script payload in the input field.
  4. Observe that the application renders the payload as-is in the HTML.
  5. The browser decodes the hex entities and executes the JavaScript.

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 shows user input without cleaning it, so an attacker can sneak in JavaScript that runs in other people's browsers. Here, the site blocked normal script tags by escaping angle brackets, but it did not block the same characters written as hex codes (like &#x3C; for <). The browser turned those codes back into a script and ran it.

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.