Skip to content
XSS Write-up Beginner

Reflected XSS with Base64 — Breaching Obscurity in Seconds

A parameter on an SSO error page was base64-encoded and decoded server-side, then reflected into the page without contextual escaping. An attacker could craft a link that executes script in the victim's browser, potentially leading to session hijack or content spoofing.

medium.com

Published on medium.com

Hi — recently I was invited to perform a pentest and harden the security posture of a well-known organization. I accepted the challenge.

embossdotar, 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 decoded a user-controlled parameter and inserted it into the HTML without contextual output encoding, relying on base64 encoding as a form of protection.

Impact

A reflected XSS in an authentication flow could lead to session hijack, content spoofing, or user-interaction bypass, though the actual impact depends on where the decoded value ends up and whether protections like HttpOnly or CSP are present.

What the attacker needed

Victim clicks a crafted link; SSO error page reflects decoded parameter

The fix

The application should apply contextual output encoding to any decoded user input before rendering it, and should not rely on base64 encoding as a security measure.

How it was found

  1. Submit a bad code on the SSO login flow to reach an error page.
  2. Notice a URL parameter containing odd characters that is base64-encoded.
  3. Decode the parameter locally to see it contains the error text.
  4. Replace the decoded text with a harmless marker and re-encode it.
  5. Observe that the marker is reflected back into the page, confirming the decode-and-render flow.

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.

The website took a value from the URL, decoded it from base64 (a way to represent data as text), and put it directly into the page without making it safe. Because the page did not escape special characters, an attacker could hide a script in that value and trick a user into clicking a link, causing the script to run in their 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.