Use after free in Payments (CVE-2026-13282)
A use-after-free vulnerability exists in the Android Autofill payment methods settings flow. When a user exits the virtual card enrollment editor while a server request is in-flight, a synchronous JNI callback deletes the parent delegate and its child objects while their methods are still executing, potentially causing a crash or heap corruption.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 29 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 potential Use-After-Free (UAF) vulnerability exists in the Android Autofill settings payment methods flow. When a user exits the server card editor while a virtual card enrollment request is in-flight, a deferred cleanup is configured. When the server response subsequently arrives, a synchronous JNI callback deletes the parent delegate and its child objects while their methods are actively executing on the stack.
Affected files:
components/autofill/core/browser/payments/virtual_card_enrollment_manager.ccchrome/browser/android/preferences/autofill/autofill_payment_methods_delegate.cccomponents/autofill/core/browser/payments/multiple_request_payments_network_interface_base.ccchrome/browser/android/preferences/autofill/autofill_payment_methods_delegate.h
Estimated timestamp from git blame: 2022-06-14
Summary
A potential Use-After-Free (UAF) vulnerability exists in the Android Autofill payment methods settings flow. When a user backs out of the virtual card enrollment or unenrollment editor while a server request is in-flight, the editor defers its native cleanup. When the server response subsequently arrives, a synchronous JNI callback is executed that deletes the parent AutofillPaymentMethodsDelegate class. Since this delegate owns both VirtualCardEnrollmentManager and the payments network interface, their destruction occurs while their methods are actively executing on the call stack, resulting in potential Use-After-Free reads/writes and heap corruption in the browser process.
Root Cause Analysis
In components/autofill/core/browser/payments/virtual_card_enrollment_manager.cc:
void VirtualCardEnrollmentManager::OnDidGetUpdateVirtualCardEnrollmentResponse(
VirtualCardEnrollmentRequestType type,
PaymentsRpcResult result) {
...
// Relay the response to the server card editor page. This also destroys the
// payments delegate if the editor was already closed.
if (virtual_card_enrollment_update_response_callback_.has_value()) {
std::move(virtual_card_enrollment_update_response_callback_.value())
.Run(result);
}
LogUpdateVirtualCardEnrollmentRequestResult(
state_.virtual_card_enrollment_fields.virtual_card_enrollment_source,
type, result == PaymentsRpcResult::kSuccess);
Reset();
}
The synchronous callback invocation .Run(result) eventually invokes RunVirtualCardEnrollmentUpdateResponseCallback inside chrome/browser/android/preferences/autofill/autofill_payment_methods_delegate.cc. This executes base::android::RunBooleanCallbackAndroid to run JNI code.
In chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillServerCardEditor.java:
mVirtualCardEnrollmentUpdateResponseCallback =
isUpdateSuccessful -> {
if (mServerCardEditorClosed) {
mDelegate.cleanup();
} else {
...
If the user closed the editor screen while the request was in-flight, mServerCardEditorClosed is true, which synchronously invokes the JNI mapping for mDelegate.cleanup(), executing delete this on AutofillPaymentMethodsDelegate.
Deconstruction of AutofillPaymentMethodsDelegate deletes VirtualCardEnrollmentManager and MultipleRequestPaymentsNetworkInterface. Consequently, when the JNI call returns, this is dangling inside OnDidGetUpdateVirtualCardEnrollmentResponse(). The execution then attempts to access state_ and call Reset(), causing a UAF read and write.
Additionally, in components/autofill/core/browser/payments/multiple_request_payments_network_interface_base.cc:
void RequestOperation::ReportOperationResult(PaymentsRpcResult result) {
CHECK(request_);
request_->RespondToDelegate(result);
payments_network_interface_->OnRequestFinished(request_operation_id_);
}
Once RespondToDelegate(result) returns, the active RequestOperation object (this) and the payments_network_interface_ have both been deleted, leading to an additional Use-After-Free dereference when attempting to call OnRequestFinished.
Because the active execution context uses stack-allocated references (including the implicit this pointer) to execute class methods on heap-allocated objects that have already been deleted, this UAF is not mitigated by raw_ptr (MiraclePtr / BackupRefPtr) protections.
Potential Steps to Trigger
Note: The following are suggested/potential steps to trigger the issue, as our tooling agent does not yet have the capability to run code or successfully compile a proof-of-concept.
- Open Chrome on Android, go to Settings -> Payment methods.
- Select an eligible server-saved card to open
AutofillServerCardEditor. - Tap "Turn on virtual card" (or "Turn off") and accept the confirmation dialog.
- Immediately exit the editor page (e.g., press Back) while the network request is still in-flight.
- If the network response arrives shortly after exiting, the synchronous cleanup should execute, potentially causing a crash or heap corruption in the browser process.
Suggested Fix
To resolve this issue, ensure that the cleanup of the AutofillPaymentMethodsDelegate occurs asynchronously rather than synchronously within the callback. This will allow the C++ call stack to safely unwind before the executing objects are deleted.
For example, modify the callback in AutofillServerCardEditor.java to post a task to the main thread's message loop rather than destroying the delegate synchronously:
mVirtualCardEnrollmentUpdateResponseCallback =
isUpdateSuccessful -> {
if (mServerCardEditorClosed) {
new Handler(Looper.getMainLooper()).post(() -> mDelegate.cleanup());
} else {
...
Evaluated with Chrome root at commit: 5133b93d189b383c37805b1cf3a9d2dbfe8d7379
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.
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
The cleanup of the delegate is performed synchronously inside a callback that is invoked while methods on the same objects are still on the call stack, leading to use-after-free.
Impact
This could cause a crash or heap corruption in the browser process, but the report notes that the tooling agent has not run code or compiled a proof-of-concept.
What the attacker needed
Chrome on Android; server-saved card; network request in-flight; user exits editor
The fix
The cleanup of the delegate should be made asynchronous by posting a task to the main thread's message loop instead of destroying it synchronously.
How it was found
- Open Chrome on Android, go to Settings -> Payment methods.
- Select an eligible server-saved card to open `AutofillServerCardEditor`.
- Tap "Turn on virtual card" (or "Turn off") and accept the confirmation dialog.
- Immediately exit the editor page (e.g., press Back) while the network request is still in-flight.
- If the network response arrives shortly after exiting, the synchronous cleanup should execute, potentially causing a crash or heap corruption in the browser process.
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.
This is a use-after-free bug, which means the program deletes an object from memory but then tries to use it again. In this case, closing a settings screen while a network request is still running causes the code to clean up too early, while other parts of the program are still using the deleted objects. This can lead to crashes or, in theory, let an attacker corrupt memory.
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.