Use after free in Payments (CVE-2026-6319)
A use-after-free occurs in Chrome's PaymentsWindowBridge because the Java object keeps a native pointer that is never cleared when the C++ object is destroyed. An attacker could crash the browser process by closing the merchant tab while an ephemeral payment tab is open.
- Fix shipped in 14 days
Steps to reproduce the problem
Continued from https://issues.chromium.org/issues/498289905.
- Checkout and apply the patch:
git checkout 14e903b7ea5de658e62e89cd56ca758a5a0c2428
git apply patch3.diff
- Build Chromium for Android:
gn gen out/Default --args='target_os="android" target_cpu="arm64" is_debug=false use_siso=false android_static_analysis="off"'
autoninja -C out/Default chrome_public_apk
- Install on a device (connect an ARM64 Android device via adb):
out/Default/bin/chrome_public_apk install
- Start the MITM proxy on the host machine:
pip install mitmproxy
mitmproxy --mode regular --listen-port 8080 -s mitm_bnpl.py
- Host the PoC files (
poc.html,poc_checkout.html,bnpl_page.html):
python3 -m http.server 8888
- Launch Chrome:
out/Default/bin/chrome_public_apk run \
--args='--enable-features=AutofillEnableBuyNowPayLater,AutofillEnableAmountExtraction,AutofillEnableAmountExtractionTesting,AutofillDisableBnplCountryCheckForTesting,AutofillEnableBuyNowPayLaterSyncing --proxy-server=http://<host>:8080 --ignore-certificate-errors'
-
Add a test credit card in Chrome Settings > Payment methods (Name: Test User, Number: 4111 1111 1111 1111, Expiry: 12/30).
-
Navigate to
http://<host>:8888/poc.htmland click "Start PoC". -
In the new tab, tap the Card Number field, select the saved card from the autofill bar, and then select "Affirm" from the Pay Later options.
-
After the ephemeral tab (bottom sheet) appears, the parent page closes the merchant tab in 10 seconds. The browser process crashes with SIGSEGV at
0xcdcdcdcdcdcdcdcdinPaymentsWindowBridge::OnWebContentsDestroyed.
Problem Description
PaymentsWindowBridge.java stores the C++ PaymentsWindowBridge pointer as a final long field:
// PaymentsWindowBridge PaymentsWindowBridge.java:19
class PaymentsWindowBridge {
private final long mNativePaymentsWindowBridge; // [1]
...
void onWebContentsDestroyed() {
PaymentsWindowBridgeJni.get().onWebContentsDestroyed(mNativePaymentsWindowBridge); // [5]
}
}
The pointer is set once in the constructor [1] and never cleared. The final keyword makes it impossible to set it to zero.
The PaymentsWindowCoordinator registers itself as an EphemeralTabObserver on the Activity-scoped EphemeralTabCoordinator:
// PaymentsWindowCoordinator.openEphemeralTab PaymentsWindowCoordinator.java:47
void openEphemeralTab(GURL url, String title, WebContents merchantWebContents) {
...
WindowAndroid windowAndroid = merchantWebContents.getTopLevelNativeWindow();
...
mEphemeralTabCoordinator = supplier.get();
mEphemeralTabCoordinator.addObserver(this); // [2]
...
}
The EphemeralTabCoordinator is retrieved from WindowAndroid's unowned user data [2], making it Activity-scoped -- it survives individual tab closures.
The C++ ownership chain is:
WebContents (merchant tab)
-> ContentAutofillClient (WebContentsUserData)
-> ChromeAutofillClient (extends ContentAutofillClient)
-> ChromePaymentsAutofillClient (member)
-> AndroidPaymentsWindowManager (unique_ptr)
-> PaymentsWindowBridge (unique_ptr)
AndroidPaymentsWindowManager owns PaymentsWindowBridge as a unique_ptr:
// AndroidPaymentsWindowManager android_payments_window_manager.h:65
class AndroidPaymentsWindowManager : public PaymentsWindowManager,
public PaymentsWindowDelegate {
...
std::unique_ptr<PaymentsWindowBridge> payments_window_bridge_; // [3]
};
The C++ destructor is defaulted and does not notify the Java side:
// PaymentsWindowBridge::~PaymentsWindowBridge payments_window_bridge.cc:30
PaymentsWindowBridge::~PaymentsWindowBridge() = default; // [4]
When the merchant tab is closed, ~WebContentsImpl destroys WebContentsUserData entries, which chains through ~ChromeAutofillClient -> ~ChromePaymentsAutofillClient -> ~AndroidPaymentsWindowManager -> ~PaymentsWindowBridge [3][4]. The defaulted destructor [4] does not call into Java to null out mNativePaymentsWindowBridge, nor does it remove the PaymentsWindowCoordinator from the EphemeralTabCoordinator's observer list.
Subsequently, when the ephemeral tab's WebContents is cleaned up, PaymentsWindowCoordinator.onWebContentsDestroyed() fires through the observer registered at [2], which calls PaymentsWindowBridge.onWebContentsDestroyed() [5], passing the dangling mNativePaymentsWindowBridge to JNI. The C++ side then dereferences payments_window_delegate_ on the freed object:
// PaymentsWindowBridge::OnWebContentsDestroyed payments_window_bridge.cc:66-68
void PaymentsWindowBridge::OnWebContentsDestroyed(JNIEnv* env) {
payments_window_delegate_->WebContentsDestroyed(); // [6] UAF: `this` is freed
}
The crash occurs at [6] because this was freed at [4], and payments_window_delegate_ (a raw_ref) now contains 0xcdcdcdcdcdcdcdcd.
The same pattern was previously found and fixed in FacilitatedPaymentsPaymentMethodsControllerBridge (crbug.com/355139788). That fix made the native pointer non-final, added an onNativeDestroyed() callback to zero it out, and guarded every JNI callback with a null check. None of these protections were applied to PaymentsWindowBridge.
Additional Comments
If a signed-in Chrome instance with a US-based Google account, a linked BNPL issuer (e.g., Affirm), and a BNPL-eligible merchant page is available, this bug can be triggered from poc.html with no patches. I don't have such account, so I used patch to reproduce. If you still think this patch inappropriate, please let me know in the comments.
Summary
Use-After-Free via dangling JNI native pointer in PaymentsWindowBridge::OnWebContentsDestroyed
Custom Questions
Type of crash:
browser
Crash state:
Please see the attached tombstone.txt
Reporter credit:
pwn2addr
Additional Data
Category: Security
Chrome Channel: Not sure
Regression: N/A \
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 PaymentsWindowBridge stores a final native pointer that is not cleared when the C++ object is destroyed, and the observer is not removed, leading to a dangling pointer dereference.
What the attacker needed
Android device with ARM64; Chrome built with specific flags; MITM proxy setup; Test credit card added
The fix
The fix should make the native pointer non-final, add an onNativeDestroyed callback to zero it out, and guard every JNI callback with a null check, as was done for FacilitatedPaymentsPaymentMethodsControllerBridge.
How it was found
- Checkout and apply the patch.
- Build Chromium for Android.
- Install on a device.
- Start the MITM proxy on the host machine.
- Host the PoC files.
- Launch Chrome with the specified flags.
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 use-after-free is when a program keeps using memory it has already freed. Here, a Java object holds a pointer to a C++ object that gets destroyed when a tab closes, but the pointer is never set to null. Later, when another tab closes, the program tries to use that stale pointer and crashes.
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.