Cross Site Scripting for Fun: PasteJacking
A search box had a self-XSS that only triggered via autosuggest, and the backend WAF blocked it on normal search. The author chained it with clickjacking and clipboard manipulation to turn it into a convincing attack.
geekboy.ninja
Published on geekboy.ninja
A few weeks ago I found an issue which initially looks like unexploitable, it was Self XSS again, this time in Search Box where users can search for books/documents, XSS get triggered once we type/paste our payload in search box via Applications AutoSuggestion feature, but once search get completed it gets blocked by…
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 search autosuggest rendered user input without proper sanitisation, and the application lacked anti-framing headers for authenticated users, allowing clickjacking.
Impact
An attacker could execute arbitrary JavaScript in the context of the victim's authenticated session, but only if the victim is tricked into pasting and the application is vulnerable to clickjacking.
What the attacker needed
Victim is authenticated; victim interacts with attacker page; application lacks anti-framing headers
How it was found
- Host a page that copies an XSS payload to the clipboard when the victim presses a key.
- Frame the vulnerable search page and position it so the search box is under the victim's cursor.
- Instruct the victim to paste into the framed search box, triggering the XSS.
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.
Self-XSS is a bug that only affects the person who types the malicious code into their own browser, so normally it is useless to an attacker. Here the attacker used a trick called clickjacking to make the victim interact with a hidden page, and also changed what was on the victim's clipboard so that pasting inserted the malicious code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.