Skip to content
DoS Disclosed report Advanced CVE-2024-5696

Crash SIGSEGV GetCaretFrameForNodeOffset at 0xffffffff (32-bit) or 0x0000ffffffff (64-bit) after malloc failure on nsTextFragment::SetTo

A memory allocation failure inside nsTextFragment::SetTo leaves the caret code with an invalid frame, so GetCaretFrameForNodeOffset dereferences a near-null pointer and crashes. An attacker could trigger this by exhausting memory and then invoking setRangeText, causing a denial of service.

Irvan Kurniawan Follow

Originally disclosed on Mozilla

  • Fixed in 2 days
  • Paid in 8 days
  • Disclosed after 2 days

Created attachment 9401574 log_minidump_00.txt

When run testcase with fillMemory and setRangeText, on Firefox official Nightly 32-bit build I notice it able to crash on GetCaretFrameForNodeOffset at 0xffffffff on 32-bit build or 0x0000ffffffff 64-bit build, the crash occur after malloc failure on nsTextFragment::SetTo.

On original testcase I able to crash at GetCaretFrameForNodeOffset as attached log_minidump_00.txt, but it still require many tries to crash reliably, have to tweak the fillMemory code. For now to reproduce the crash reliably we can simulate the malloc failure on nsTextFragment::SetTo and visit the testcase-for-patch.html.

On local build I able to crash as described after checkout on commit Bug 1860328 - Track nsCaret position at the DOM level

Steps to reproduce:

  1. Apply nsTextFragment-setTo-failure.patch
  2. Compile Firefox
  3. Visit attached testcase-for-patch.html
  4. Firefox crash on GetCaretFrameForNodeOffset

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

Impact

The browser crashes, giving a denial of service; the report notes the original testcase needed many tries to crash reliably.

What the attacker needed

Memory exhaustion; victim loads a crafted page

How it was found

  1. Apply the patch that simulates the allocation failure
  2. Compile Firefox
  3. Visit the provided test page
  4. Firefox crashes in GetCaretFrameForNodeOffset

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.

When a program runs out of memory, it should handle that gracefully. Here, a text-editing function fails to allocate memory, and the code that positions the blinking text cursor (the caret) then uses a broken reference and crashes the browser. An attacker who can force memory exhaustion and then trigger a text replacement can make the browser tab crash.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

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.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.