Skip to content
Memory corruption Disclosed report Advanced CVE-2021-23995

AddressSanitizer: heap-use-after-free [@ EntryCount] using toggle responsive design mode (ctrl+shift+m)

A crafted HTML page caused a heap-use-after-free in Firefox's hash table code when the user toggled Responsive Design Mode. The tab crashed, which an attacker could use to disrupt the browser session.

Irvan Kurniawan Follow

Originally disclosed on Mozilla

  • Fixed in 11 days
  • Paid in 18 days
  • Disclosed after 11 days

Created attachment 9210438 testcase.html

After visit the testcase, when toggling the responsive design mode, the tab crashed with summary: AddressSanitizer: heap-use-after-free /builds/worker/workspace/obj-build/dist/include/PLDHashTable.h:434:40 in EntryCount.

Affected version:

  • Firefox Nightly 88.0a1 (2021-03-19) (64-bit)
  • Firefox Release 86.0.1 (64-bit)
  • Firefox ESR 78.8.0esr (64-bit)

Steps to Reproduce:

  1. Visit attached testcase.html
  2. Press Ctrl + Shift + M to switch to Responsive Design Mode
  3. After ~5 seconds the page will reload itself
  4. After the page reload, press Ctrl + Shift + M to exit the Responsive Design Mode
  5. The tab crashed

The original report as published on Mozilla's Bugzilla, by Irvan Kurniawan. 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 a hash table entry was freed while still referenced during the responsive design mode reload, leading to a use-after-free in EntryCount.

Impact

The tab crashed, which could let an attacker disrupt the browser session; the report does not claim code execution.

What the attacker needed

Victim opens a crafted page; victim toggles Responsive Design Mode

How it was found

  1. Open the provided test case page.
  2. Press Ctrl+Shift+M to enter Responsive Design Mode.
  3. Wait about five seconds for the page to reload itself.
  4. Press Ctrl+Shift+M again to exit Responsive Design Mode.
  5. The tab crashes.

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.

A use-after-free is a memory bug where a program keeps using a piece of memory after it has been freed, so the data there can be wrong or controlled by someone else. Here a specially made web page plus a keyboard shortcut for a developer tool made Firefox read freed memory and crash the tab.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Irvan Kurniawan

View all

72 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.