Skip to content
Memory corruption Disclosed report Advanced

AddressSanitizer: heap-buffer-overflow [@ sse2_composite_over_x888_8_8888] when print or save to PDF

A crafted HTML page caused a heap-buffer-overflow read in the pixman SSE2 compositing routine when the page was printed or saved to PDF. An attacker could crash the browser (a denial of service) by getting a victim to open the page and print it.

Irvan Kurniawan Follow

Originally disclosed on Mozilla

  • Fixed in 10 days
  • Paid in 16 days
  • Disclosed after 10 days

Created attachment 9207351 testcase.html

The testcase crashes Firefox ASAN on Linux with SUMMARY: "AddressSanitizer: heap-buffer-overflow /builds/worker/checkouts/gecko/gfx/cairo/libpixman/src/pixman-sse2.c:4919:13 in sse2_composite_over_x888_8_8888 with READ of size 4 at 0x61000074d2f4"

When I change testcase JS code from String.fromCodePoint(10040); into String.fromCodePoint(10100); the ASAN shadow bytes point will change from [04] into [fa].

The code in pixman-sse2.c:4919 (that ASAN show) is from commit Bug 1689998 - Update pixman sources to release 0.40.0 as below:

memcpy(&m, mask++, sizeof(uint32_t));

Reproduced on:

  • Firefox ASAN build on last commit ca22dc040c3a6f9257efdaedec848bb48334f8bd (HEAD -> master, origin/master, origin/HEAD) (Sat Mar 6 05:40:39 2021 +0000) on Arch Linux
  • Firefox ASAN from fuzzfetch with Build ID 20210305214118 on Arch Linux

Steps to reproduce:

  1. Open Firefox ASAN with recent build
  2. Visit attached testcase.html
  3. When print dialog show, select Destination "Save to PDF" (default on my desktop) or "Print to File" (on Firefox ESR Linux)
  4. Click "Save" or "Print"
  5. Browser 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 the SSE2 compositing routine reads a mask pixel past the end of the mask buffer when handling this particular glyph during PDF/print rendering.

Impact

An attacker could crash the browser (denial of service) when a victim prints or saves the crafted page to PDF; the report shows only a crash, not code execution.

What the attacker needed

Victim opens a crafted HTML page; victim prints or saves to PDF; Firefox build with pixman 0.40.0

How it was found

  1. Open a Firefox ASAN build.
  2. Visit the attached testcase page.
  3. In the print dialog choose Save to PDF or Print to File.
  4. Click Save or Print; the 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.

A heap-buffer-overflow is when a program reads or writes past the end of a block of memory it allocated. Here the graphics library used for printing read four bytes beyond a buffer, which the memory checker AddressSanitizer detected and which crashed the browser. The trigger is a page containing a particular character that is drawn during printing.

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.