Skip to content
XSS Write-up Intermediate

Copy Drag — Paste Drop

The write-up describes how to trigger XSS in a WYSIWYG editor that only executes when content is dropped into it, by tricking a user into dragging attacker-controlled content onto the editor. Because framing is blocked by X-Frame-Options, the author uses scroll-to-text-fragment and a window hash trick to bring the editor into view so the drop lands there.

Renwa Hiwa Follow

Published on medium.com

This going to be a small write-up about XSS’ing some contexts that need user interactions by using drag and drop on modern apps, and i think im COVID-19 positive :)

Renwa, 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 WYSIWYG editor accepts dropped HTML content and renders it without adequate sanitisation, so attacker-supplied markup executes as script.

Impact

An attacker could execute script in the victim's session on the target site, but only if the victim performs the drag-and-drop interaction and the browser supports the scrolling tricks used.

What the attacker needed

Victim performs a drag-and-drop; target uses a vulnerable WYSIWYG editor; browser supports scroll-to-text-fragment

How it was found

  1. Build a page that overrides the dragged content so the victim drags attacker-controlled data.
  2. Use scroll-to-text-fragment to scroll the target page down to the editor.
  3. Have the victim drop the dragged content into the editor after a short delay.
  4. Alternatively, open a new window and set its location hash to the editor element's ID to scroll to it.

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.

Some web pages only run dangerous code when you paste or drop something into them, so an attacker needs the victim to perform that action. This write-up shows how to make a victim drag a harmless-looking item and drop it into the right spot on a page, even though the page cannot be embedded in a frame. The trick is to scroll the page so the drop target is visible at the moment the user releases the mouse.

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 Renwa Hiwa

View all

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