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

Use after free in PDFium (CVE-2026-10002)

Two PDFium field property setters pass a raw pointer to the form-fill environment alongside a JavaScript conversion call as sibling arguments, so the conversion can run script that destroys the environment and leaves the pointer dangling. An attacker could craft a PDF whose script frees the plugin during the setter and then have native code dereference the freed object.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 13 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. 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 (UAF) vulnerability exists in PDFium's JavaScript engine when setting certain field properties. Indeterminate C++ evaluation order allows a raw pointer to the form environment to be captured as a function argument before a reentrant JavaScript call destroys the underlying object.

Affected files:

  • third_party/pdfium/fxjs/cjs_field.cpp
  • third_party/pdfium/fxjs/cjs_field.h

Estimated timestamp from git blame: 2017-10-19

Root Cause Analysis

In third_party/pdfium/fxjs/cjs_field.cpp, the functions CJS_Field::set_display and CJS_Field::set_line_width contain a sequencing hazard that can lead to a Use-After-Free (UAF).

These functions pass a raw pointer obtained from an ObservedPtr (form_fill_env_.Get()) and a value conversion that triggers JavaScript reentrancy (pRuntime->ToInt32(vp)) as sibling arguments to a function call. For example, in CJS_Field::set_display:

C++
// third_party/pdfium/fxjs/cjs_field.cpp:1278-1279
SetDisplay(form_fill_env_.Get(), field_name_, form_control_index_,
           pRuntime->ToInt32(vp));

Per the C++17 specification ([expr.call]/8), the evaluation of function arguments is indeterminately sequenced. If the compiler evaluates form_fill_env_.Get() before pRuntime->ToInt32(vp), it captures a raw pointer to the CPDFSDK_FormFillEnvironment object.

The pRuntime->ToInt32(vp) call can execute arbitrary JavaScript (e.g., via a valueOf method). If this JavaScript causes the destruction of the CPDFSDK_FormFillEnvironment (e.g., by navigating the page or removing the PDF element from the DOM), the captured raw pointer becomes dangling. The subsequent execution of the callee (SetDisplay or SetLineWidth) immediately dereferences this dangling pointer.

Affected Code

  • CJS_Field::set_display (line 1278) calling SetDisplay (dereference at line 328).
  • CJS_Field::set_line_width (line 1547) calling SetLineWidth (dereference at line 377).

Other properties, such as border_style, correctly hoist the conversion call to a separate statement, avoiding this hazard.

Potential Attack Steps

  1. Provide a PDF with a form field and a script.
  2. The script assigns a property (e.g., display) to an object with a custom valueOf method.
  3. Inside valueOf, trigger a nested event loop (e.g., app.alert) and simultaneously cause the PDF plugin to be destroyed (e.g., by the embedding page removing the iframe).
  4. After the plugin is destroyed and the environment is freed, return from the valueOf method.
  5. The native code resumes and calls the callee with the dangling environment pointer.

Suggested Fix

Hoist the JavaScript-reentrant conversion calls into a separate statement before retrieving the raw pointer from the ObservedPtr. This ensures the pointer is retrieved (and potentially checked) only after all JavaScript execution for that setter has finished:

C++
int nValue = pRuntime->ToInt32(vp);
if (!form_fill_env_)
  return CJS_Result::Failure(JSMessage::kBadObjectError);
SetDisplay(form_fill_env_.Get(), field_name_, form_control_index_, nValue);

Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

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 the argument evaluation order in C++ is unspecified, so a raw pointer from an ObservedPtr is captured before a JavaScript-reentrant conversion call that can destroy the underlying object.

Impact

A crafted PDF could cause the browser to dereference freed memory, which may lead to memory corruption, though the text does not demonstrate a working exploit.

What the attacker needed

Victim opens a crafted PDF; PDF embedded in a page that can remove it; scripting enabled in the PDF viewer

The fix

The conversion call should be hoisted into its own statement and the environment pointer re-checked before the setter is called.

How it was found

  1. Provide a PDF containing a form field and a script.
  2. Have the script assign a property such as display to an object with a custom valueOf method.
  3. Inside valueOf, start a nested event loop and cause the PDF plugin to be destroyed.
  4. Return from valueOf after the environment has been freed.
  5. The native code resumes and calls the callee with the dangling pointer.

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 keeps a note of where an object lives, the object is deleted, and the program then reads or writes through the old note. Here the program fetches that note and runs some JavaScript in the same step, and the JavaScript can delete the object before the note is used. A malicious PDF could exploit this to make the browser read freed memory.

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.