Skip to content
Access control Disclosed report Intermediate CVE-2024-8900

Can write to clipboard from beforeunload event handler if navigation is user-triggered

Firefox allowed a page to write to the clipboard from a beforeunload handler when the user triggered a reload, bypassing the clipboard permission prompt. An attacker could copy text to the victim's clipboard without consent.

Apip Follow

Originally disclosed on Mozilla

  • Fixed in 8 months
  • Paid in 8 months
  • Disclosed after 8 months
Text
Created attachment 9370857
firefox_bypass_copy_to_clipboard.mp4

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Steps to reproduce:

I found a "copy to clipboard" protection error in the clipboard access permission prompt when there was a page that asked to automatically paste text to the user's clipboard.

Normally: when a page asks to automatically enter text into the user's clipboard a permission prompt will appear.

Bug: Unfortunately, the bug that I found can bypass it even though the prompt status is blocked, where the reload function in the browser makes it possible to bypass the copy to clipboard permission automatically without the user having to touch the attacker's website page and simply being in the address bar or something. Maybe the browser has made a patch so that it requires user interaction to be able to copy to the clipboard which is already focused on the page, but unfortunately, it seems that the reload function enters the entire browser panel including automatically focusing on the page without the user knowing, so if the user is forced to press reload even though the user not in page focus for fear of threats, instead of protecting myself, but the text was successfully copied.

1. Go to https://bug.omapip.my.id/bar.html
2. For Firefox you can click the reload button on the browser
3. Check your clipboard


Actual results:

Copy to clipboard protection bypassed


Expected results:

The browser should ensure Copy to the clipboard can run and a permission prompt appears when the user focuses on the page rather than the browser to avoid other functions being executed via the browser instead of the page.

The original report as published on Mozilla's Bugzilla, by Apip. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the browser treated a user-triggered reload as sufficient user activation for clipboard writes, even when the write happened in a beforeunload handler rather than from a direct page interaction.

Impact

A page could write attacker-controlled text to the clipboard without a permission prompt, which could be used to trick the user into pasting malicious content.

What the attacker needed

Victim visits a malicious page; victim reloads the page

The fix

The browser should require a permission prompt for clipboard writes and not treat a reload as sufficient user activation for beforeunload handlers.

How it was found

  1. Open the provided test page in Firefox.
  2. Click the browser's reload button.
  3. Check the clipboard contents.

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 report has not been written yet. The Original tab links to the source.

Websites can ask to copy text to your clipboard, and normally the browser shows a permission prompt. This report found that if a page runs code when you reload it, Firefox would copy text without asking. That means a malicious page could put text in your clipboard without you agreeing.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.