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

Race in Payments (CVE-2026-8520)

The Java PaymentAppService drops references to native-backed JniPaymentApp objects without explicit cleanup, so the Java garbage collector finalises them on a background thread and destroys UI-thread-affine C++ objects off-thread. This causes a data race in the WebContents observer list, potentially leading to heap corruption and remote code execution in the privileged browser process.

Google Chrome

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 26 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: During payment app deduplication, Java JniPaymentApp references are dropped without explicitly cleaning up their native C++ counterparts. When Android's Garbage Collector later finalizes these objects on a background thread, it synchronously destroys UI-thread-affine C++ objects like SecurePaymentConfirmationApp. This triggers off-thread modification of the WebContents observer list, causing concurrent memory mutation and potential heap corruption in the privileged Browser process.

Affected files:

  • components/payments/content/android/java/src/org/chromium/components/payments/PaymentAppService.java
  • components/payments/content/android/java/src/org/chromium/components/payments/JniPaymentApp.java
  • components/payments/content/secure_payment_confirmation_app.h
  • components/payments/content/service_worker_payment_app.h
  • components/webauthn/content/browser/internal_authenticator_impl.h

Estimated timestamp from git blame: 2024-10-01

Summary

There is a potential thread-safety vulnerability in the Android PaymentApp implementation. The Java-side PaymentAppService drops references to native-backed JniPaymentApp objects without calling their explicit cleanup method (dismissInstrument()). Relying on the Java Garbage Collector to finalize these objects results in C++ destructors executing on the Android FinalizerDaemon thread instead of the Browser UI thread. Because these C++ objects observe WebContents, destroying them off-thread leads to a data race in base::ObserverList, allowing an attacker to corrupt the heap in the Browser process.

Vulnerability Details

  1. In PaymentAppService.java, the deduplicatePaymentApps method filters out redundant payment apps (for example, hiding a Service Worker payment app if a preferred native Android app is present).
  2. When an app is filtered out, it is removed from the local collections (e.g., uniquePaymentApps) and the temporary mPossiblyDuplicatePaymentApps list is cleared. The references are dropped without invoking dismissInstrument().
  3. The unreferenced JniPaymentApp instances become eligible for Java Garbage Collection.
  4. When the GC runs, the Android FinalizerDaemon thread executes JniPaymentApp.finalize(), which calls dismissInstrument() and crosses the JNI boundary to invoke JniPaymentApp::FreeNativeObject(env).
  5. FreeNativeObject executes delete this;, which destroys the underlying C++ PaymentApp object (such as SecurePaymentConfirmationApp or ServiceWorkerPaymentApp) entirely on the background FinalizerDaemon thread.
  6. SecurePaymentConfirmationApp inherits from content::WebContentsObserver. Its destructor implicitly calls ~WebContentsObserver(), which invokes WebContentsImpl::RemoveObserver(this).
  7. WebContentsImpl::RemoveObserver calls RemoveObserver on its base::ObserverList.
  8. If base::ObserverList currently has no active iterators (live_iterators_.empty()), it bypasses its internal sequence checker and directly calls observers_.erase(it) on its underlying std::vector.
  9. This concurrent std::vector::erase() execution from a background thread races against the Browser UI thread, which frequently reads, iterates, and mutates the same WebContents observer list.

Because std::vector is not thread-safe, this data race causes use-after-free or memory corruption inside the highly-privileged Browser process, potentially leading to a Sandbox Escape and Remote Code Execution (RCE).

Potential Reproduction Steps

Note: Our tooling agent cannot run code yet, so these steps are theoretical based on code analysis.

  1. An attacker hosts a malicious website that registers a Service Worker payment handler.
  2. The Service Worker's web-app manifest includes "prefer_related_applications": true and specifies a widely installed Android native payment app as a related application.
  3. The attacker's site invokes a PaymentRequest with methods that match both the Service Worker and the Android native app.
  4. During the payment app discovery phase, both apps are instantiated in C++ and Java.
  5. PaymentAppService.deduplicatePaymentApps drops the Java reference to the Service Worker app in favor of the native app.
  6. The attacker uses memory-intensive JavaScript to apply memory pressure, forcing an Android Garbage Collection.
  7. The FinalizerDaemon triggers the C++ destructor off-thread. Concurrent UI actions (like navigating the WebContents or registering a new observer) cause a data race in the ObserverList, crashing or corrupting the Browser process.

Suggested Fix

  1. Explicit Cleanup: Update PaymentAppService.java to explicitly call dismissInstrument() on any PaymentApp instances that are discarded during deduplication or when a PaymentRequest is aborted/closed, ensuring resources are freed deterministically on the UI thread.
  2. Thread Enforcement: Update JniPaymentApp::FreeNativeObject to ensure the C++ object is always deleted on the UI thread, regardless of which thread initiates it. For example, use content::GetUIThreadTaskRunner({})->DeleteSoon(...) instead of a direct delete this;.

Evaluated with Chrome root at commit: 661452647ddb2827305122ff3273bd5dea403f09


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 Java code drops references to JniPaymentApp objects without calling dismissInstrument(), so the Java finaliser destroys the native C++ object on a background thread instead of the UI thread.

Impact

This data race could cause use-after-free or memory corruption in the privileged browser process, potentially leading to a sandbox escape and remote code execution.

What the attacker needed

Android device with Chrome; Victim visits attacker's website; Attacker registers a Service Worker payment handler; Manifest sets prefer_related_applications to true

The fix

The fix should explicitly call dismissInstrument() on discarded PaymentApp instances and ensure native objects are always deleted on the UI thread, for example by using DeleteSoon instead of a direct delete.

How it was found

  1. An attacker hosts a malicious website that registers a Service Worker payment handler.
  2. The Service Worker's web-app manifest includes "prefer_related_applications": true and specifies a widely installed Android native payment app as a related application.
  3. The attacker's site invokes a PaymentRequest with methods that match both the Service Worker and the Android native app.
  4. During the payment app discovery phase, both apps are instantiated in C++ and Java.
  5. PaymentAppService.deduplicatePaymentApps drops the Java reference to the Service Worker app in favor of the native app.
  6. The attacker uses memory-intensive JavaScript to apply memory pressure, forcing an Android Garbage Collection.

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.

When a payment app is no longer needed, the Java code simply forgets about it instead of cleaning it up properly. Later, Java's automatic memory cleaner (the garbage collector) runs on a background thread and destroys the underlying C++ object there, but that object is only safe to destroy on the main UI thread. This can corrupt memory in the browser process, which is dangerous because that process has high privileges.

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.