AddressSanitizer: attempting free on address which was not malloc()-ed on cairo_cff_font_destroy -> free
A memory-safety bug in Firefox's cairo graphics code caused the browser to crash when saving a page to PDF from the print dialog. The crash was an invalid free of an address that was not allocated by malloc, which an attacker could trigger by getting a victim to print a crafted page.
Originally disclosed on Mozilla
- Fixed in 4 days
- Paid in 6 days
- Disclosed after 4 days
Created attachment 9398465 asan.attemptfree1.txt
After Save to PDF from print dialog, the entire browser crashed, gladly I able to get detailed analysis from AddressSanitizer, the crash is attempting free on address which was not malloc()-ed which points to gfx/cairo.
Tested on:
- Firefox Nightly 127.0a1 (2024-04-24) (64-bit) on Arch Linux (X11)
- Firefox Beta 126.0b5 (64-bit) on Arch Linux (X11)
Steps to reproduce:
- Visit attached testcase.html
- When Print dialog is appear
- Click Save
- Save the PDF file to destination path
- After a seconds the entire browser crashed
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 double free or freeing of a pointer that was not heap-allocated in the cairo font destruction path, triggered during PDF generation.
Impact
Saving a crafted page to PDF crashes the entire browser, which could be used to disrupt a victim, though the report does not show code execution.
What the attacker needed
Victim opens a crafted page; victim saves it to PDF from print dialog
How it was found
- Open the attached test case page in the browser.
- Wait for the print dialog to appear.
- Click Save.
- Choose a destination path and save the PDF file.
- After a few seconds the whole browser 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.
When a program needs memory it asks the operating system for a block, and later it must hand that same block back. Here the browser tried to hand back a block it never received, which is like returning a library book you never borrowed. The program cannot cope with that mistake and shuts down, so the whole browser closes.
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.