Use after free in Printing (CVE-2026-11647)
Native Android printing code cached a raw file descriptor integer from Java without being told when Java closed it, leaving a stale handle. A compromised renderer could then get that integer reused for a sensitive browser resource and write attacker-controlled bytes to it, potentially escaping the sandbox.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 57 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.
Overview: PrintingContextAndroid caches a raw file descriptor from Java but is not notified when the descriptor is closed upon print dialog dismissal. A compromised renderer can exploit this by reclaiming the freed file descriptor integer for a sensitive browser resource. The attacker can then use the printing pipeline to write arbitrary data to the reclaimed descriptor, leading to a potential sandbox escape.
Affected files:
printing/printing_context_android.ccprinting/android/java/src/org/chromium/printing/PrintingControllerImpl.javaprinting/printing_context_android.hchrome/browser/printing/print_view_manager_base.ccprinting/metafile_skia.cc
Estimated timestamp from git blame: 2021-12-04
Summary
A potential Use-After-Close (UAC) vulnerability exists in the Android printing pipeline within the Chromium browser process. PrintingContextAndroid caches a raw POSIX file descriptor (FD) extracted from a Java-owned ParcelFileDescriptor. When the print dialog is dismissed or the activity is destroyed, Java safely closes the FD. However, the native code is not notified and retains the stale integer. A compromised renderer can cause the browser to reclaim this FD integer for a sensitive resource (e.g., a Mojo channel or database) and subsequently write attacker-controlled bytes to it, leading to a sandbox escape.
Root Cause Analysis
In printing/printing_context_android.cc, the method AskUserForSettingsReply caches a raw integer FD from the Java layer:
fd_ = Java_PrintingContext_getFileDescriptor(env, j_printing_context_);
This FD originates from PrintingControllerImpl.java, which holds it in a ParcelFileDescriptor (mFileDescriptor).
Several lifecycle events in PrintingControllerImpl.java—such as onFinish() (called when the print dialog is dismissed) and onActivityDestroyed()—invoke closeFileDescriptor(). This method calls mFileDescriptor.close(), releasing the FD in the Linux kernel.
Critically, none of these paths notify the native PrintingContextAndroid object to invalidate its cached fd_. The C++ object simply retains the dangling integer. Later, PrintingContextAndroid::PrintDocument writes directly to this unvalidated integer via MetafileSkia::SaveToFileDescriptor(fd_) and base::WriteFileDescriptor.
Potential Attack Scenario
The following steps describe how a compromised renderer could theoretically trigger this vulnerability. (Note: These are suggested steps based on static analysis; our tooling agent does not currently have the ability to execute code to verify this with a live Proof of Concept).
- Open Dialog & Populate FD: The compromised renderer sends a
ScriptedPrintIPC withis_scripted=true. This opens the Android system print dialog. The Android framework callsonWritein Java to generate a preview, which populatesPrintingControllerImpl.mFileDescriptor. The browser replies withkCanceledto unblock the renderer, but the dialog remains open. - Cache the FD in Native: The renderer sends a second
ScriptedPrintIPC, this time withis_scripted=false. Because the dialog is still open, Java reports success. The native code fetches the FD from the activePrintingControllerImpland caches the raw integer in a newPrintingContextAndroidobject. - Close the FD: The user dismisses the dialog (or the attacker programmatically triggers an Activity lifecycle change).
PrintingControllerImpl.onFinish()closes the kernel FD. The C++PrintingContextAndroidstill holds the dangling integer. - Reclaim the FD: The renderer rapidly sprays FD allocations in the browser process (e.g., by creating many Mojo IPC channels or Blobs). The Linux kernel reuses the lowest available FD integer, causing one of the new, sensitive browser resources to be assigned the same integer value as the cached
fd_. - Arbitrary File Write: The renderer sends
DidPrintDocumentwith an arbitrary byte payload in a shared memory region. The browser bypasses PDF compositing (which happens by default on low-memory Android devices where OOPIF is disabled), reads the attacker's raw payload viaMetafileSkia::InitFromData, and writes it verbatim to the reclaimedfd_usingbase::WriteFileDescriptor.
Suggested Fix
Do not cache the raw file descriptor integer in PrintingContextAndroid. Instead, refactor the code to query the ParcelFileDescriptor from Java exactly at the time the write is performed in PrintDocument(). Alternatively, implement a listener or callback mechanism that strictly nullifies or invalidates fd_ in the native layer when PrintingControllerImpl closes the ParcelFileDescriptor.
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
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 native printing code cached a raw file descriptor integer from Java and was never notified when the Java side closed it, so the stale integer was later written to without validation.
Impact
A compromised renderer could potentially write arbitrary data to a sensitive browser resource, leading to a sandbox escape, though the report notes this was not verified with a live proof of concept.
What the attacker needed
Compromised renderer; Android device; user dismisses print dialog
The fix
The code should stop caching the raw descriptor integer and instead fetch it from Java at write time, or invalidate the cached value when Java closes it.
How it was found
- The compromised renderer sends a scripted print request, opening the Android print dialog and populating the file descriptor.
- The renderer sends a second print request that is not scripted, so the native code caches the raw descriptor integer.
- The dialog is dismissed, Java closes the descriptor, but the native object keeps the stale integer.
- The renderer sprays descriptor allocations so a sensitive browser resource reuses the same integer.
- The renderer sends a print document with an arbitrary payload, which is written to the reclaimed descriptor.
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 file descriptor is a small number the operating system uses to refer to an open file or connection. The browser kept a copy of that number after the real file had been closed, so the number could later point at something else important. If an attacker can make the browser reuse that number for a sensitive connection, the attacker's data could be written into it.
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.