Skip to content
Race condition Advisory Advanced CVE-2026-17722

Object lifecycle issue in WebView (CVE-2026-17722)

A raw file descriptor handed from Java to native code during WebView PDF export was stored without being duplicated, so its lifetime stayed tied to the Java object. A compromised renderer could race the print callbacks to make the framework close that descriptor while a delayed background write was still pending, potentially writing attacker data into a reallocated sensitive descriptor.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 47 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 raw file descriptor passed from Java to C++ during WebView PDF export is not duplicated, making its lifecycle dependent on the Android Print framework. A compromised renderer can force the framework to close this file descriptor while a background task holding the raw integer is pending. The background task may subsequently write arbitrary attacker-controlled data to a reallocated, sensitive file descriptor in the browser process.

Affected files:

  • android_webview/browser/aw_print_manager.cc
  • android_webview/browser/aw_print_manager.h
  • android_webview/java/src/org/chromium/android_webview/AwPdfExporter.java
  • components/printing/browser/print_manager.cc

Estimated timestamp from git blame: Unknown (Google3 checkout)

Description

A potential Use-After-Close (UAC) vulnerability exists in the Android WebView PDF export functionality (AwPrintManager). When a host application requests a PDF export, a ParcelFileDescriptor is passed to the native C++ side. However, the native code extracts the raw integer file descriptor and stores it without duplicating it (dup()) and without managing it via a base::ScopedFD.

Because the native side does not take true ownership of the file descriptor, a compromised renderer can manipulate Mojo IPC messages to force a race condition. By triggering an error state that propagates back to the Java layer, the Android framework can be instructed to close the file descriptor while a heavily delayed BEST_EFFORT background task is still waiting to write to it. If the closed file descriptor integer is reallocated to a sensitive resource (like a Mojo IPC socket or Binder FD) before the background task executes, the attacker's arbitrary PDF data will be written to that resource.

Potential Exploitation Steps

Note: These are suggested steps based on static analysis; our tooling agent does not yet have the ability to run code to verify a full exploit chain.

  1. Initiation: The Android host application initiates a PDF export (e.g., via the system print dialog). The Java layer (AwPdfExporter.java) passes the raw integer FD to the native AwPdfExporter::ExportToPdf().
  2. Unsafe Storage: In AwPrintManager::UpdateParam(), the raw integer is stored in fd_. It is not duplicated, leaving its system lifecycle tied to the Java ParcelFileDescriptor.
  3. First Malicious IPC: A compromised renderer intercepts the print request and sends a PrintManagerHost.DidPrintDocument Mojo IPC to the browser process, providing the correct document cookie and a shared memory region containing a malicious payload.
  4. Task Posting: On the UI thread, AwPrintManager::DidPrintDocument() securely extracts fd_ (setting it to kInvalidFd) and posts a SaveDataToFd task to a BEST_EFFORT ThreadPool. This task captures the raw integer FD by value.
  5. Second Malicious IPC: Immediately after sending DidPrintDocument, the compromised renderer sends a PrintManagerHost.PrintingFailed Mojo IPC on the same channel.
  6. Premature Closure: PrintingFailed executes sequentially on the UI thread. It bypasses CHECK_EQ(fd_, base::kInvalidFd) (because fd_ was cleared in step 4) and calls PdfWritingDone(0). This triggers the Java callback AwPdfExporter.didExportPdf(0), which sets mFd = null and notifies AwPrintDocumentAdapter to call onWriteFailed(null). The Android Print framework then closes the underlying system file descriptor.
  7. Resource Reallocation: The attacker rapidly creates new connections (e.g., WebSockets, Mojo) in the browser process. The Linux kernel assigns the recently freed file descriptor integer to one of these sensitive resources.
  8. UAC Execution: The delayed BEST_EFFORT background task SaveDataToFd executes, calling base::WriteFileDescriptor with the old integer value. The malicious payload is written directly into the newly allocated, sensitive resource.

Impact

Writing arbitrary, attacker-controlled data to a privileged file descriptor (such as a Mojo pipe) in the browser process allows for a direct Sandbox Escape and potential Remote Code Execution (RCE) in the context of the browser process.

Suggested Fix

Modify AwPdfExporter and AwPrintManager to take ownership of the file descriptor using base::ScopedFD. When passing the file descriptor from Java to C++, use dup() to create an independent reference that is not tied to the Java ParcelFileDescriptor lifecycle. This is identical to a fix previously applied to PrintingContextAndroid.

Evaluated with Chrome root at commit: 65b3256311f3ab6fb9870eaa522de7e6dd2663bb


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 native code stored the raw descriptor integer without dup() or a scoped owner, so its lifetime remained controlled by the Java ParcelFileDescriptor and the Android print framework.

Impact

Writing attacker-controlled data into a privileged descriptor in the browser process could allow a sandbox escape and potentially remote code execution, though the report states the chain was not run and is based on static analysis.

What the attacker needed

Compromised renderer; PDF export triggered by host app; race won against background task

The fix

The descriptor should be owned through a scoped wrapper and duplicated when passed from Java to C++, so it is independent of the Java object's lifecycle.

How it was found

  1. The host application starts a PDF export and the Java layer passes the raw descriptor to native code.
  2. The native print manager stores the integer without duplicating it.
  3. A compromised renderer sends a DidPrintDocument message with the correct cookie and a shared memory payload.
  4. The UI thread clears the stored descriptor and posts a best-effort background task that captures the integer.
  5. The renderer immediately sends a PrintingFailed message, which triggers the Java callback and lets the print framework close the descriptor.
  6. The attacker opens new connections so the freed number is reused, then the delayed task writes the payload into that resource.

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. Here the browser kept a copy of that number without making its own separate reference, so when the original owner closed it, the number could be reused for something else, and a late write could land in the wrong place. The report is based on reading the code, not on a working exploit.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.