Skip to content
XSS Write-up Beginner

Whitelisting goes wrong

The application allowed users to control the source URL of an iframe, and its whitelist check only verified that the trusted domain string appeared anywhere in the URL. An attacker could host a malicious HTML file with a name containing the trusted domain and load it in the iframe, leading to cross-site scripting.

yappare Follow

Published on blog.yappare.com

The original lives on blog.yappare.com

We do not hold its text, 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 whitelist validation used a substring match on the full URL rather than parsing and comparing the hostname, allowing the trusted domain to appear in the path or filename.

Impact

An attacker could execute arbitrary JavaScript in the context of the geoportal application, potentially stealing session data or performing actions on behalf of the victim.

What the attacker needed

Control over the iframe source URL; ability to host a file on an external server

How it was found

  1. Identify that the iframe source URL is user-controlled and only checked for the presence of the trusted domain string.
  2. Create an HTML file containing an XSS payload and name it with the trusted domain as part of the filename.
  3. Host the file on an external server.
  4. Set the iframe source URL to the external file's URL, which contains the trusted domain string, so it passes the whitelist.

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.

A whitelist is a list of allowed values. Here, the site checked if a trusted domain name appeared anywhere in a user-supplied web address, instead of checking the actual domain. By putting the trusted name in a file name on their own server, an attacker could make the site load their malicious page, which could run code in the victim's browser.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by yappare

View all

14 more disclosed reports, best first.

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.