Use after free in PDFium (CVE-2026-11306)
PDFium's garbage collector adapter fails to override a task-runner method, so object destructors are deferred indefinitely; combined with a focus-handling bug that leaves a caret timer running, an attacker could reallocate a parent widget and trigger a virtual call on controlled memory, potentially leading to code execution in the renderer.
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 https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: PDFium's CFXGC_Platform fails to properly override GetForegroundTaskRunner, causing cppgc object destructors to be indefinitely deferred. Combined with a focus-handling bug in CFWL_ComboEdit that leaves a timer active, an attacker can reallocate a parent widget while a child caret's timer remains firing. When the timer eventually fires, it performs a virtual method call on the attacker-controlled parent memory, potentially leading to RCE.
Affected files:
third_party/pdfium/fxjs/gc/heap.cppthird_party/pdfium/xfa/fwl/cfwl_comboedit.cppthird_party/pdfium/xfa/fwl/cfwl_edit.cppthird_party/pdfium/xfa/fwl/cfwl_caret.cppthird_party/pdfium/xfa/fwl/cfwl_widgetmgr.cppthird_party/pdfium/core/fxcrt/cfx_timer.cpp
Estimated timestamp from git blame: 2025-04-03
Vulnerability Details
This potential vulnerability arises from the intersection of two distinct bugs in PDFium's XFA implementation:
1. Broken cppgc Foreground Finalization
In third_party/pdfium/fxjs/gc/heap.cpp, the CFXGC_Platform class acts as an adapter between the V8 platform and the cppgc heap. However, it fails to override the priority-based GetForegroundTaskRunner(TaskPriority) virtual method from cppgc::Platform. When the cppgc Sweeper attempts to schedule foreground finalization tasks (which execute destructors for garbage-collected objects) via platform_->GetForegroundTaskRunner(kForegroundRegularPriority), the call resolves to the base class implementation and returns nullptr. Consequently, the Sweeper silently aborts scheduling these tasks, causing objects to remain in swept_unfinalized_pages queues with their destructors deferred indefinitely.
2. Flawed Caret Cleanup in CFWL_ComboEdit
When a ComboBox widget receives a kKillFocus message, CFWL_ComboEdit::OnProcessMessage intercepts it, clears the FWL_STATE_WGT_Focused flag, and explicitly sets backDefault = false to prevent the base class (CFWL_Edit::OnProcessMessage) from handling the event (third_party/pdfium/xfa/fwl/cfwl_comboedit.cpp:40). Because the base class is bypassed, CFWL_Edit::OnFocusLost() is never called, and HideCaret() is skipped. The caret's CFX_Timer remains active, holding an UnownedPtr (which is an unprotected raw pointer within the cppgc cage) back to the caret.
Potential Attack Scenario
While our tooling agent does not run code to provide a working PoC, the code strongly indicates an attacker could trigger a Use-After-Free (UAF) using the following suggested steps:
- Focus the Widget: The attacker's script grants focus to an XFA
ComboBox. This initializes aCFWL_Caretobject and starts a 600msCFX_Timerfor blinking. - Bypass Cleanup: The script sends a
kKillFocusevent to the widget. Due to Bug #2, the focus flag is cleared, but the timer is never stopped. - Orphan Objects & GC: The script removes the widget from the DOM and forces a garbage collection cycle.
- Bypass PreFinalize: During GC,
CFWL_Edit::PreFinalizeexecutes. Because the focus flag was already maliciously cleared in step 2, theHideCaret()cleanup check fails. The objects are queued for finalization but are indefinitely deferred due to Bug #1. - Heap Grooming:
CFWL_Caret(112 bytes) lives incppgc'skNormal3space, whileCFWL_ComboEdit(~244 bytes) lives inkNormal4. The attacker forces numerous allocations specifically sized for thekNormal4bucket. - Targeted Reallocation: This forces the allocator to call
SweepForAllocationIfRunningon thekNormal4space, which finally reclaims the unfinalizedCFWL_ComboEdit. The attacker controls the newly allocated memory, forging a fake vtable. TheCFWL_Caret(inkNormal3) remains unfinalized, its memory intact, and its timer still active. - Exploitation: When the 600ms timer expires,
CFX_Timer::TimerProcdereferences theUnownedPtrto the unfinalized caret. The caret attempts to repaint, walking up its parent pointer (outer_) to the now-attacker-controlledCFWL_ComboEditmemory. The loop invokes a virtual method (pNative->GetWidgetRect()), hijacking the execution flow and potentially allowing arbitrary code execution within the sandboxed renderer process.
Proposed Fixes
-
Fix
CFXGC_Platformoverride: Inthird_party/pdfium/fxjs/gc/heap.cpp, implement the missing override forGetForegroundTaskRunner(cppgc::TaskPriority)so that foreground finalization tasks are properly scheduled.C++ std::shared_ptr<cppgc::TaskRunner> GetForegroundTaskRunner( cppgc::TaskPriority priority) override { return g_platform->GetForegroundTaskRunner(g_isolate, priority); } -
Fix
CFWL_ComboEditfocus handling: Inthird_party/pdfium/xfa/fwl/cfwl_comboedit.cpp, ensure that whenkKillFocusis processed, proper caret cleanup is performed. This can be done by invokingHideCaret()or by allowingCFWL_Edit::OnProcessMessageto handle focus loss normally.
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.
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 combination of a missing override for the foreground task runner in the garbage-collector platform adapter, which defers finalisation, and a focus-loss handler that bypasses the base class and leaves the caret timer active.
Impact
The report claims this could potentially allow arbitrary code execution within the sandboxed renderer process, though no working proof of concept was run.
What the attacker needed
Attacker-supplied PDF with XFA script; victim opens the PDF in Chrome; renderer process sandbox
The fix
The report proposes implementing the missing override for the foreground task runner and ensuring caret cleanup on focus loss, either by calling HideCaret or by letting the base class handle the event.
How it was found
- Grant focus to an XFA ComboBox, which starts a caret blink timer.
- Send a kill-focus event so the focus flag is cleared but the timer keeps running.
- Remove the widget from the DOM and force a garbage collection cycle.
- During collection, the prefinalisation check fails to hide the caret, and finalisation is deferred.
- Force many allocations sized for the bucket holding the combo-edit object to reclaim its memory.
- When the timer fires, the caret walks to the reallocated parent and calls a virtual method on attacker-controlled 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 the component that displays PDFs inside Chrome. A timer that blinks a text cursor keeps a pointer to an object that should have been cleaned up; because of a second bug, the cleanup never happens, and the memory can be reused by an attacker. When the timer fires, the program follows the stale pointer and may run attacker-chosen 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.