Skip to content
XSS Write-up Beginner

Reflected Cross-Site Scripting (XSS) via POST request:

A POST endpoint reflected user-supplied JSON values into HTML without proper encoding for the image field, allowing an attacker to inject a script that executes in the victim's browser. The attacker could perform actions such as stealing cookies or redirecting the user.

medium.com

Published on medium.com

Hi, welcome to my first blog! In this post, I will share my experience of discovering a Reflected XSS vulnerability in a public BugCrowd program.

Ahmed Rizk, 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 failed to HTML-encode the 'image' value before inserting it into the page, unlike other fields which had encoding safeguards.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to session hijacking or other client-side attacks.

What the attacker needed

Victim clicks a crafted link or submits a form

How it was found

  1. Send a POST request with JSON data to the endpoint.
  2. Inject unique characters into each JSON value to see which are reflected.
  3. Observe that the image value is reflected without HTML encoding.
  4. Craft a payload that breaks out of the dialog and injects a script, using Unicode for quotes and JavaScript comments to bypass the WAF.
  5. The payload executes in the victim's browser.

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.

When a website takes input from a user and puts it directly into a web page without cleaning it, an attacker can sneak in malicious code. Here, the 'image' field was not properly cleaned, so a crafted request could run a script in the victim's browser. This is called reflected cross-site scripting (XSS).

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.