Skip to content
Memory corruption Advisory Advanced CVE-2026-9957

Use after free in PDF (CVE-2026-9957)

A use-after-free write exists in Chrome's PDF Ink2 annotation feature because PDFium's FPDFPage_InsertObject silently frees a page object on validation failure while Chrome retains a dangling pointer. An attacker could craft a PDF that triggers this, potentially leading to remote code execution within the renderer sandbox.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 38 days

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential Use-After-Free vulnerability exists in Chrome's Ink2 annotation feature. FPDFPage_InsertObject silently frees a page object on validation failure, but the calling Chrome code assumes success and retains a dangling pointer that is subsequently used for memory writes during undo/redo or thumbnail generation.

Affected files:

  • pdf/pdfium/pdfium_ink_writer.cc
  • third_party/pdfium/fpdfsdk/fpdf_editpage.cpp
  • pdf/pdfium/pdfium_engine.cc
  • third_party/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp

Estimated timestamp from git blame: 2025-07-29

Root Cause Analysis

The vulnerability is a potential Use-After-Free (UAF) write in the PDF plugin process. It originates from an inconsistent ownership model between PDFium and its Chrome integration for the Ink2 feature.

  1. Silent Free in FPDFPage_InsertObject: The PDFium function FPDFPage_InsertObject (in third_party/pdfium/fpdfsdk/fpdf_editpage.cpp) takes ownership of an FPDF_PAGEOBJECT by wrapping it in a std::unique_ptr. It then validates the destination page by calling IsPageObject. If the validation fails, the function returns early. This causes the unique_ptr to go out of scope and delete the CPDF_PageObject before it can be added to the page, effectively freeing it. Because the function has a void return type, it provides no error signal to the caller.

  2. Normalization Gap: IsPageObject checks if the page dictionary's /Type key is a Name object with the exact value "Page". While PDFium's CountPages attempts to normalize malformed /Type keys during document load, this normalization is skipped if the root /Pages dictionary contains a valid /Count entry. Consequently, a maliciously crafted PDF can contain a page that loads normally but permanently fails the IsPageObject check.

  3. Dangling Pointer Retention: The Chrome Ink2 writer (pdf/pdfium/pdfium_ink_writer.cc) calls FPDFPage_InsertObject via WriteStrokeToPage and explicitly releases its ownership of the object. It assumes the operation succeeds and continues to cache the now-dangling raw pointer in its internal ink_stroke_data_ map in PDFiumEngine.

  4. UAF Write Sink: When a user undoes a stroke, PDFiumEngine::UpdateStrokeActive iterates through these cached (dangling) pointers and calls FPDFPageObj_SetIsActive. This eventually leads to CPDF_PageObject::SetIsActive (in third_party/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp), which performs a UAF write to the is_active_ and dirty_ boolean fields at fixed offsets within the freed object. A secondary sink exists via thumbnail generation, which temporarily toggles the active state.

Impact

This is a Use-After-Free write in the sandboxed PDF plugin process. Since the dangling handles are opaque C pointers (FPDF_PAGEOBJECT) and not base::raw_ptr<>, the vulnerability is not protected by MiraclePtr (BackupRefPtr). An attacker can control the number of freed objects and the timing of the subsequent write. Exploitation could lead to remote code execution within the renderer sandbox.

Potential Reproduction Steps

Note: These are suggested steps to trigger the issue, our tooling agent has not executed this code.

  1. Craft a PDF where the root /Pages dictionary has a valid /Count but a child page dictionary has a malformed /Type entry (e.g., /Type (Page) as a literal string or an invalid name like /Type /Paje).
  2. Open the PDF in Chrome and enter Annotate mode (via the toolbar pencil icon).
  3. Draw a stroke on the page. On mouse-up, WriteStrokeToPage will call FPDFPage_InsertObject. PDFium will silently free the created path objects while Chrome's PDFiumEngine caches the dangling handles.
  4. Press Ctrl+Z (Undo) or trigger a thumbnail request. This will cause PDFiumEngine to access the dangling pointers and perform UAF writes to the is_active_ and dirty_ fields.

Suggested Fix

FPDFPage_InsertObject and similar C API functions should not silently free objects on failure if they return void. They should either return a boolean/error code to indicate failure so the caller can handle the memory, or they should return the pointer back to the caller on failure.

Alternatively, if the API contract is strict about taking ownership regardless of success, the Ink2 integration code needs a mechanism to query the page state before yielding ownership, or Chrome needs to verify the object was successfully inserted (e.g., by checking object count) and prune dangling pointers if it wasn't. Updating the API to return a success boolean, similar to FPDFPage_InsertObjectAtIndex, is the most robust approach.

Evaluated with Chrome root at commit: 7353d249d9cacf9c7218e1d7b8a39cf39c72d646


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 an inconsistent ownership model: FPDFPage_InsertObject takes ownership and frees the object on validation failure without signalling the caller, which then keeps a dangling pointer.

Impact

Exploitation could lead to remote code execution within the renderer sandbox, though the report notes the steps are suggested and not executed.

What the attacker needed

Victim opens a crafted PDF; victim uses Annotate mode; victim draws a stroke; victim undoes or triggers thumbnail

The fix

The API should be updated to return a success boolean so callers can handle failure, or the integration code should verify insertion and prune dangling pointers.

How it was found

  1. Craft a PDF with a valid /Count in the root /Pages dictionary but a child page dictionary with a malformed /Type entry.
  2. Open the PDF in Chrome and enter Annotate mode.
  3. Draw a stroke on the page, causing WriteStrokeToPage to call FPDFPage_InsertObject, which silently frees the object while Chrome caches dangling handles.
  4. Press Ctrl+Z (Undo) or trigger a thumbnail request, causing access to the dangling pointers and UAF writes.

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 happens when a program frees memory but keeps using it, like deleting a file and then trying to open it. Here, a PDF function frees an object but the caller still thinks it exists and writes to it later. This could let an attacker control what happens in that freed memory, possibly running their own code.

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 from Google Chrome

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.