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

Use after free in Browser (CVE-2026-95298)

A model quality log entry could be destroyed on a background thread during profile teardown, causing its destructor to dereference a UI-thread-bound weak pointer and mutate an unsynchronised vector. This could lead to a browser-process use-after-free or heap corruption.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 4 months

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 thread safety issue exists where a ModelQualityLogEntry can be deleted off the UI thread on a ThreadPool sequence during profile teardown. Its destructor performs cross-sequence dereferencing of a UI-thread-bound WeakPtr and modifies an unsynchronized std::vector on a background thread. This can result in a potential browser-process Use-After-Free (UAF) or heap corruption.

Affected files:

  • chrome/browser/contextual_tasks/contextual_tasks_context_service.cc
  • components/optimization_guide/core/model_quality/model_quality_log_entry.cc
  • components/optimization_guide/core/model_quality/model_quality_logs_uploader_service.cc
  • chrome/browser/contextual_tasks/contextual_tasks_context_model_handler.cc
  • components/optimization_guide/core/inference/model_handler.h

Estimated timestamp from git blame: 2026-04-16

Description

A potential security issue exists in the interaction between ContextualTasksContextService and the ModelHandler infrastructure. During profile or browser teardown, a callback chain containing a std::unique_ptr<ModelQualityLogEntry> can be silently discarded and destroyed on a background BEST_EFFORT ThreadPool sequence instead of the UI thread.

When ModelQualityLogEntry is destroyed off the UI thread, its destructor (components/optimization_guide/core/model_quality/model_quality_log_entry.cc:37) executes non-thread-safe operations:

  1. It dereferences and invokes methods on uploader_ (a base::WeakPtr<ModelQualityLogsUploaderService> bound to the UI thread), violating sequence safety constraints and potentially leading to a Use-After-Free (UAF) if the uploader is concurrently destroyed on the UI thread.
  2. It calls SetMqlsLogForWebUI which performs an unsynchronized push_back into the mqls_logs_for_web_ui_ vector (components/optimization_guide/core/model_quality/model_quality_logs_uploader_service.cc:287), risking concurrent mutation and heap corruption.

Potential Mechanism of Off-Thread Destruction

  1. ContextualTasksContextService::OnQueryEmbeddingReady (chrome/browser/contextual_tasks/contextual_tasks_context_service.cc:482) instantiates a ModelQualityLogEntry on the UI thread.
  2. This log entry is moved into a callback chain passed to model_handler_->BatchExecuteModelWithSignals.
  3. The executor (TFLiteModelExecutor) posts an asynchronous OpenModelFile task to a background ThreadPool runner (model_loading_task_runner_). The reply callback (transitively owning the log entry) is parked waiting for completion.
  4. Concurrently, the user closes the profile. KeyedService teardown on the UI thread calls ~ModelHandler, which invokes model_task_runner_->DeleteSoon(model_executor_).
  5. Because the task runner is sequenced, the DeleteSoon task runs before the OpenModelFile reply task. This destroys the executor and invalidates its execution-thread WeakPtr.
  6. When the reply task is eventually dequeued, its receiver WeakPtr is invalid. The callback is canceled, causing its BindState (and thus the ModelQualityLogEntry) to be destroyed synchronously on the background ThreadPool sequence instead of returning to the UI thread.

Potential Steps to Reproduce

Note: Our tooling agent does not currently have the capability to execute code or run a live proof of concept; therefore, these are suggested and potential steps based on code analysis.

  1. Enable the ContextualTasksContext feature (which has active platform testing configs).
  2. Initiate a query that prompts contextual search processing, invoking BatchExecuteModelWithSignals.
  3. While the background model loading task (OpenModelFile) is executing on the ThreadPool, close the profile or browser window to trigger service teardown.
  4. Observe potential browser process instability or memory corruption assertions in debug builds due to ~ModelQualityLogEntry executing off-sequence.

Suggested Fix

Ensure that the ModelQualityLogEntry is always deleted on the thread where its bound WeakPtr and uploader service live (the UI thread).

One robust fix is to wrap the callback or the log entry destructor using a helper that enforces UI-thread deletion, such as wrapping the pointer in a custom deleter that posts destruction to the UI thread if executed off-sequence:

C++
struct UIThreadDeleter {
  void operator()(optimization_guide::ModelQualityLogEntry* ptr) const {
    if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
      delete ptr;
    } else {
      content::GetUIThreadTaskRunner({})->DeleteSoon(FROM_HERE, ptr);
    }
  }
};

Alternatively, ensure that the callbacks passed to ModelHandler that own UI-thread-bound resources are safely bound using base::BindPostTask or destroyed via custom helpers that handle off-sequence cancellation gracefully.

Evaluated with Chrome root at commit: e9507a33bb4148ee071aaaf8a7e9ad68770359bf


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.

Raised in root component due to access or custom field issues on 1516765

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 a callback owning a UI-thread-bound object was cancelled on a background sequence, so the object's destructor ran off the UI thread and performed non-thread-safe operations.

Impact

This could cause a browser-process use-after-free or heap corruption, though the report is based on code analysis and no live proof of concept was executed.

What the attacker needed

ContextualTasksContext feature enabled; A query that triggers model execution; Profile or browser teardown during model loading

The fix

The log entry should always be deleted on the UI thread, for example by using a custom deleter that posts destruction to the UI thread when executed off-sequence.

How it was found

  1. Enable the ContextualTasksContext feature.
  2. Start a query that triggers contextual search processing and the batch model execution.
  3. While the background model loading task is running, close the profile or browser window.
  4. Observe potential browser process instability or memory corruption assertions in debug builds.

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 you close a browser profile, background tasks may still be running. A log object meant to be cleaned up on the main thread could instead be deleted on a background thread, where it touches data that is not safe to touch from there. This can crash the browser or 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.

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.