Skip to content
XSS Write-up Advanced

Day 7: Drag & Drop XSS + Cookie Bomb for OAuth Hijacking

The platform used jQuery's .html() to process dropped image URLs, allowing an attacker to inject script when a victim drags an image. Combined with a missing OAuth state parameter and a cookie bomb that caused a header-too-large error, the attacker could steal the OAuth token and log in as the victim.

danielbelay Follow

Published on medium.com

📌 Issue: html() is used instead of text(), leading to XSS when an attacker-controlled image is dropped.

dani3l, 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 use of jQuery's .html() instead of .text() to process user-supplied image URLs, combined with a missing OAuth state parameter and no limit on cookie size.

Impact

The attacker could log into the victim's account remotely, though the OAuth token expired immediately when used by the server, which was bypassed with the cookie bomb.

What the attacker needed

Victim drags an attacker-controlled image; OAuth login from a parent domain; attacker can set many large cookies

How it was found

  1. The attacker tricks the victim into dragging an image.
  2. Using dataTransfer.setData(), the payload gets injected into the image's href value.
  3. When the image is dropped, XSS is triggered.
  4. Fill the victim's cookies with large values (8KB+ per cookie).
  5. When the OAuth response arrives, the server rejects it due to Header Too Large error.
  6. The attacker then steals the OAuth token from the URL.

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 an image link and inserted it into the page as HTML instead of plain text, so a malicious link could run code in the victim's browser. Separately, the login flow did not use a security code (state parameter) to tie the login response to the right user, and the attacker overloaded the victim's cookies so the server rejected the login response, letting the attacker grab the token from the URL.

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 danielbelay

View all

7 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.