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

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

A use-after-free flaw in PDFium's XFA engine occurs when V8 wrappers for cppgc-managed objects are created without rooting, allowing the underlying C++ object to be freed while the wrapper still holds a raw pointer. An attacker could potentially trigger this by loading a malicious PDF with JavaScript, leading to a virtual call on freed memory and possible remote code execution.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 44 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 go/chrome-ai-generated-security-bugs-faq for more information.

Overview: A potential Use-After-Free vulnerability exists in PDFium's XFA implementation when V8 wrappers for cppgc-managed objects are created without proper rooting. If the underlying C++ object is removed from the DOM and garbage collected, the V8 wrapper retains a raw pointer to freed memory. Accessing this wrapper from JavaScript triggers a virtual call on the freed object, potentially leading to Remote Code Execution.

Affected files:

  • third_party/pdfium/fxjs/xfa/cfxjse_engine.cpp
  • third_party/pdfium/fxjs/xfa/cfxjse_context.cpp
  • third_party/pdfium/fxjs/xfa/cjx_list.cpp
  • third_party/pdfium/fxjs/xfa/cjx_tree.cpp

Estimated timestamp from git blame: 2022-06-10

Summary

A potential Use-After-Free (UAF) vulnerability exists in PDFium's XFA engine. The issue arises because certain code paths, such as CFXJSE_Engine::NewNormalXFAObject, create V8 wrappers that hold raw C++ pointers to CJX_Object (which are cppgc::GarbageCollected objects) without ensuring they are rooted.

Because PDFium's cppgc heap is standalone (not unified with V8) and configured with kNoConservativeStackScan, the raw pointers hidden in V8 internal fields are not traced. If an XFA node is removed from the DOM, it loses its C++ Member<> references. If no Persistent<> roots exist, the object will be collected during the next cppgc cycle, even if the JavaScript environment still holds the V8 wrapper.

(Note: This vulnerability is gated by the kPdfXfaSupport feature, which is currently disabled by default without active field trials. The following steps are potential and have not been executed, as our tooling cannot currently run code.)

Root Cause Analysis

In third_party/pdfium/fxjs/xfa/cfxjse_engine.cpp, the safe path for creating bindings is GetOrCreateJSBindingFromMap. This method ensures that any created V8 binding is stored in map_object_to_object_. This map uses cppgc::Persistent<CJX_Object> as a key, effectively rooting the object and preventing garbage collection while the V8 wrapper is alive.

However, CFXJSE_Engine::NewNormalXFAObject completely bypasses this map:

C++
v8::Local<v8::Object> CFXJSE_Engine::NewNormalXFAObject(CXFA_Object* obj) {
  v8::EscapableHandleScope scope(GetIsolate());
  v8::Local<v8::Object> object = obj->JSObject()->NewBoundV8Object(
      GetIsolate(), GetJseNormalClass()->GetTemplate(GetIsolate()));
  return scope.Escape(object);
}

NewBoundV8Object calls FXJSE_UpdateObjectBinding, which stashes the raw C++ pointer in a V8 internal field (GetAlignedPointerFromInternalField(1)). Unsafe callers that utilize this unrooted path include CJX_List::item and CJX_Tree::nodes. Nodes obtained via these methods receive a V8 wrapper, but the engine does not track them with a Persistent handle.

Potential Steps to Trigger

An attacker could potentially trigger this vulnerability by following these steps:

  1. Load a malicious PDF: The user opens a PDF with XFA support enabled containing attacker-controlled JavaScript.
  2. Stash an unrooted wrapper: The script accesses an XFA list and retrieves a node using myList.item(0). This routes to CJX_List::item and creates an unrooted V8 wrapper. The script stores this wrapper in a global variable.
  3. Sever DOM references: The script removes the node from the DOM (e.g., myList.remove(myNode)). This calls GCedTreeNodeMixin::RemoveChild, which sets the cppgc::Member tree pointers (like parent_ and next_sibling_) to nullptr.
  4. Trigger Garbage Collection: The script allocates a large amount of memory to create allocation pressure. Since cppgc cannot see the V8 wrapper's internal fields, and the node has no remaining Member or Persistent roots, cppgc frees the CJX_Object.
  5. Use-After-Free: The script reads a property on the globally stashed wrapper (e.g., stashedNode.className). V8 dispatches this to CFXJSE_Engine::NormalPropertyGetter, which retrieves the dangling raw pointer from the internal field and calls pHostObj->AsCJXObject(). This virtual call on freed memory could be leveraged for Remote Code Execution in the renderer process.

Suggested Fix

Modify CFXJSE_Engine::NewNormalXFAObject (and any similar unsafe V8 wrapper creation paths) to ensure that the newly created bindings are properly registered in map_object_to_object_, or explicitly establish a cppgc::Persistent root for the CJX_Object before returning the wrapper to JavaScript.

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, the function NewNormalXFAObject creates V8 wrappers without registering them in the persistent map, so the underlying cppgc-managed object can be garbage collected while the wrapper still holds a raw pointer.

Impact

This could potentially lead to remote code execution in the renderer process, but the vulnerability is gated by the kPdfXfaSupport feature, which is currently disabled by default without active field trials.

What the attacker needed

XFA support enabled (kPdfXfaSupport); Victim opens a malicious PDF; JavaScript execution in PDF

The fix

The fix should ensure that newly created bindings are properly registered in map_object_to_object_ or explicitly establish a cppgc::Persistent root for the CJX_Object before returning the wrapper to JavaScript.

How it was found

  1. Load a malicious PDF with XFA support enabled containing attacker-controlled JavaScript.
  2. Access an XFA list and retrieve a node using myList.item(0), creating an unrooted V8 wrapper, and store it in a global variable.
  3. Remove the node from the DOM, which clears its cppgc Member pointers.
  4. Allocate large amounts of memory to trigger garbage collection, freeing the CJX_Object.
  5. Read a property on the stashed wrapper, causing a virtual call on freed memory.

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.

PDFium is a library that renders PDFs, and XFA is a feature that lets PDFs contain interactive forms with JavaScript. A use-after-free happens when a program frees memory but keeps using it, which can let an attacker run their own code. Here, a JavaScript object could still point to a deleted internal object, and calling it might crash or execute malicious 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.