Skip to content
XSS Write-up Advanced

XSS in Zagat, exploiting a XOR-based obfuscation algorithm

A newsletter confirmation page reflected a user-supplied email parameter after decoding it through a XOR and position-based obfuscation scheme, and the decoded value was written into the HTML page without proper escaping. An attacker could craft a parameter that decoded to arbitrary HTML and JavaScript, so script ran in the victim's browser without any interaction.

blog.miki.it

Published on blog.miki.it

This is a very interesting vulnerability I internally reported, and is now fixed. I find it interesting because it is not the usual XSS, but it exploits a XOR-based obfuscation algorithm of a user-controlled input.

Michele Spagnuolo, on blog.miki.it

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 decoded email value was inserted into the HTML page without output encoding, so the obfuscation was treated as protection when it was only a reversible encoding.

Impact

An attacker could run script in the browser of anyone who opened the crafted link, with no interaction beyond visiting it.

What the attacker needed

Victim opens a crafted link; no account needed

The fix

The issue was fixed by adding proper output protection so the decoded value can no longer inject markup or script.

How it was found

  1. Open the newsletter processing URL with a crafted email parameter.
  2. The server decodes the obfuscated value and writes it into the confirmation page.
  3. The injected script executes in the 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.

The site took a scrambled value from the web address, unscrambled it, and put the result straight into the page. Because the unscrambling could be reversed and abused, an attacker could make the page contain their own script. That script then runs in the browser of anyone who opens the crafted link, which is called cross-site scripting.

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.