Skip to content
XSS Write-up Beginner

How I Found 3 Critical Reflected XSS Bugs Using Simple URL Encoding Tricks

Three reflected cross-site scripting vulnerabilities were found in an academic web application, where user input from the URL path and the 'destination' query parameter was reflected without proper output encoding. An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to account takeover or other client-side attacks.

ahmad.suhendra1405 Follow

Published on medium.com

In an age where modern frameworks promise built-in security, it’s surprising how even seemingly minor lapses can lead to critical security vulnerabilities. In this article, I share how I discovered three reflected XSS (Cross-Site Scripting) vulnerabilities on an academic web application — all of which were exposed…

Ahmad Suhendra, 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

The application reflected user-controlled input from the URL path and the 'destination' parameter directly into HTML without context-aware output encoding.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to account takeover via stolen cookies, redirection to malicious sites, or unauthorized actions on behalf of users.

What the attacker needed

Victim clicks a crafted link

The fix

The application should properly decode and validate input server-side and encode output based on its context (HTML, attribute, or JavaScript).

How it was found

  1. Notice that the application reflects parts of the URL path in the page, such as breadcrumbs or error messages.
  2. Craft a URL path containing an encoded payload that breaks out of HTML context and injects a script tag.
  3. Observe that the script executes when the page loads.
  4. Notice that the 'destination' parameter is reflected unsanitized into the DOM, possibly in an anchor tag or JavaScript redirection code.
  5. Craft a URL with an encoded payload in the 'destination' parameter that breaks out of an attribute and injects a script tag.
  6. Observe that the script executes when the page loads.

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.

Reflected cross-site scripting (XSS) happens when a website takes something you typed or clicked (like part of a web address) and puts it directly into the page without cleaning it first. If an attacker crafts a special link, the website will run the attacker's code in the victim's browser, which can steal login sessions or do things as the victim. This report shows three places where that happened because the site didn't properly encode the output.

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.