Skip to content
Memory corruption Advisory Advanced CVE-2026-13283

Use after free in AdFilter (CVE-2026-13283)

A race condition in the Android AdsBlockedDialog allows a use-after-free when a tab is closed while a dialog show task is pending. An attacker could trigger this by closing the tab after the user interacts with the dialog, potentially leading to arbitrary code execution in the browser process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 15 days

Flapjack, 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 race condition in the Android AdsBlockedDialog can lead to a potential Use-After-Free in the browser process. If a tab is closed while an asynchronous UI task to show the dialog is pending, the native C++ object is destroyed but the Java object retains a dangling pointer. Subsequent user interaction with the delayed dialog triggers a JNI call on the freed memory.

Affected files:

  • components/subresource_filter/android/java/src/org/chromium/components/subresource_filter/AdsBlockedDialog.java
  • components/subresource_filter/android/ads_blocked_dialog.cc
  • components/subresource_filter/content/browser/ads_blocked_message_delegate.cc

Estimated timestamp from git blame: 2021-11-20

Summary

A potential Use-After-Free (UAF) vulnerability exists in the Android AdsBlockedDialog component. The issue stems from an asynchronous UI task queuing mechanism combined with an incomplete cleanup path in ModalDialogManager. Under specific conditions, an attacker can trigger the destruction of a WebContents while a dialog show task is pending on the UI thread, causing the C++ object to be freed without safely unregistering the Java counterpart.

Technical Details

When a user clicks "Learn more" on an ads-blocked dialog, AdsBlockedMessageDelegate sets a reprompt_required_ = true flag and navigates the user to a support page. Upon returning to the original tab, AdsBlockedMessageDelegate::OnWebContentsFocused calls ShowDialog(true), which invokes the Java method AdsBlockedDialog.show(true) via JNI.

Because the dialog is being restored, the Java implementation avoids displaying it immediately and instead posts a task to a Handler:

Java
// AdsBlockedDialog.java
if (shouldPostDialog) {
    mDialogHandler.post(() -> 
        mModalDialogManager.showDialog(assumeNonNull(mDialogModel), ModalDialogType.TAB));
}

If the underlying WebContents is destroyed while this Runnable is still pending in the queue, the C++ AdsBlockedMessageDelegate is destroyed. This triggers the destructor of the native AdsBlockedDialog object, which calls the Java dismiss() method:

Java
// AdsBlockedDialog.java
@CalledByNative
void dismiss() {
    mModalDialogManager.dismissDialog(mDialogModel, DialogDismissalCause.DISMISSED_BY_NATIVE);
}

Crucially, inside ModalDialogManager.dismissDialog(), there is an early return if the dialog is not currently showing and not in the pending queue:

Java
// ModalDialogManager.java
if (mCurrentPresenter == null || model != mCurrentPresenter.getDialogModel()) {
    if (mPendingDialogContainer.remove(model)) { ... return; }
    return; // Early return without triggering onDismiss!
}

Since the Runnable hasn't executed yet, the dialog is in neither state, meaning dismissDialog returns early. Because of this, AdsBlockedDialog.onDismiss() is completely bypassed.

As a result:

  1. mDialogHandler.removeCallbacksAndMessages(null) is not called, leaving the Runnable active.
  2. mNativeDialog is not set to 0, leaving a dangling pointer to the freed C++ object.

When the UI thread processes the Runnable, the dialog appears. Any user interaction (such as clicking the positive button) leads to AdsBlockedDialogJni.get().onAllowAdsClicked(mNativeDialog), executing a base::OnceClosure inside the freed C++ object and potentially granting Arbitrary Code Execution in the browser process.

Potential Exploitation Steps

Note: Our tooling agent cannot run live code, so these are potential steps derived from static analysis.

  1. An attacker's site triggers an Ads Blocked message.
  2. The user interacts with the UI (e.g., clicking "Manage" and then "Learn more"), which opens a new tab and sets reprompt_required_ = true.
  3. The user switches back to the attacker's tab.
  4. The attacker's page detects the user returning (e.g., via the visibilitychange event) and immediately closes the tab context (e.g., using window.close() if it was a popup).
  5. This synchronously destroys the WebContents and the native AdsBlockedDialog, but the Java show task is already queued on the UI thread.
  6. The UI thread executes the queued task, presenting the "Ads blocked" dialog to the user over the active tab.
  7. The user clicks a button on the dialog, triggering a JNI call on the freed native pointer.

Proposed Fix

To fix this issue, AdsBlockedDialog.dismiss() must proactively clean up its own state regardless of whether ModalDialogManager considers the dialog active.

Modify AdsBlockedDialog.java:

Java
@CalledByNative
void dismiss() {
    // Immediately cancel pending tasks and clear the pointer
    mDialogHandler.removeCallbacksAndMessages(null);
    mNativeDialog = 0;
    
    // Proceed with standard dismissal
    mModalDialogManager.dismissDialog(mDialogModel, DialogDismissalCause.DISMISSED_BY_NATIVE);
}

Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff


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 dismiss method in AdsBlockedDialog does not cancel pending handler tasks or clear the native pointer when ModalDialogManager early-returns because the dialog is neither showing nor pending.

Impact

An attacker could potentially achieve arbitrary code execution in the browser process, though the report notes this is a potential issue derived from static analysis and not yet demonstrated.

What the attacker needed

Victim uses Android Chrome; attacker's site triggers ads-blocked dialog; victim clicks Manage then Learn more; victim returns to attacker's tab

The fix

The dismiss method should proactively cancel pending handler tasks and clear the native pointer before calling ModalDialogManager.dismissDialog.

How it was found

  1. An attacker's site triggers an Ads Blocked message.
  2. The user clicks 'Manage' then 'Learn more', opening a new tab and setting reprompt_required_ = true.
  3. The user switches back to the attacker's tab.
  4. The attacker's page detects the return via visibilitychange and immediately closes the tab context, e.g. using window.close() if it was a popup.
  5. This synchronously destroys the WebContents and the native AdsBlockedDialog, but the Java show task is already queued on the UI thread.
  6. The UI thread executes the queued task, presenting the dialog; the user clicks a button, triggering a JNI call on the freed native pointer.

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, where a program keeps a pointer to memory that has already been freed. If the program later uses that pointer, it can crash or be tricked into running attacker-controlled code. Here, a dialog on Android could be shown after its underlying native object was destroyed, and clicking a button on that dialog would use the freed 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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.