Use after free in Views (CVE-2026-17670)
A use-after-free was identified in View::OrphanLayers, which keeps a raw pointer to a parent layer while a loop removes child layers. Removing a layer can synchronously abort an animation, and an observer callback could destroy the parent layer, leaving the pointer dangling for later iterations.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 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 without the Chrome Security team. 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 View::OrphanLayers because it maintains a raw pointer to a parent layer across a loop that can trigger synchronous destruction of that parent via animation observers.
Affected files:
ui/views/view.ccui/compositor/layer.cc
Estimated timestamp from git blame: Unknown (Google3 checkout)
Summary
A potential Use-After-Free (UAF) vulnerability has been identified in View::OrphanLayers within ui/views/view.cc. The function iterates through the layers associated with a View and removes them from their parent ui::Layer. However, the removal process can trigger synchronous callbacks that destroy the parent layer, causing the raw parent pointer to dangle during subsequent iterations of the loop.
Technical Analysis
In ui/views/view.cc, View::OrphanLayers captures the parent layer as a raw pointer and iterates over child layers:
// ui/views/view.cc:3763
if (ui::Layer* parent = layer()->parent()) {
for (ui::Layer* layer : GetLayersInOrder()) {
// ... crash key instrumentation accesses parent->name() ...
parent->Remove(layer);
}
}
When parent->Remove(layer) is called (located in ui/compositor/layer.cc), it attempts to stop any ongoing animations on the child layer to ensure consistent state:
// ui/compositor/layer.cc:432
child_animator->StopAnimatingProperty(LayerAnimationElement::BOUNDS);
Stopping an animation synchronously triggers LayerAnimationObserver callbacks, such as OnLayerAnimationAborted. An observer can execute arbitrary logic, including destroying the Widget or View that owns the parent layer. If the parent layer is destroyed during the first iteration of the loop, the parent pointer in View::OrphanLayers becomes dangling.
Subsequent iterations will attempt to access this freed memory, first during crash key instrumentation (e.g., calling parent->name()) and then in the next parent->Remove(layer) call.
This re-entrancy risk is a known pattern; a similar issue was addressed within Layer::Remove itself (see crbug.com/1088432) by adding a base::WeakPtr guard. However, the outer loop in View::OrphanLayers lacks such protection. Production crash data (tracked in b/319941708) and the presence of investigative crash keys in the current source code confirm that this re-entrant state is being reached in the field.
While the ui::Layer class is protected by ADVANCED_MEMORY_SAFETY_CHECKS(), which can enable Scheduler-Loop Quarantine to prevent immediate memory reuse, the vulnerability still allows for a Use-After-Free dereference in the unsandboxed browser process.
Potential Attack Steps
An attacker might attempt to trigger this vulnerability through the following suggested steps:
- Identify a
Viewthat manages multiple layers (e.g., a View usingAddLayerToRegionfor shadows or background effects). - Initiate a bounds animation on one of the auxiliary layers.
- Attach a malicious animation observer that destroys the parent
Viewor itsWidgetwhen the animation is aborted. - Trigger a UI action from a compromised renderer that causes the child
Viewto be removed from its parent (e.g., closing a tab or a specific UI component). - During
OrphanLayers, the first layer removal aborts the animation, the observer destroys the parent layer, and the subsequent iteration dereferences the dangling parent pointer.
Suggested Fix
The loop in View::OrphanLayers should be made re-entrancy safe. This can be achieved by using a base::WeakPtr<ui::Layer> to track the parent layer's lifetime:
base::WeakPtr<ui::Layer> weak_parent = layer()->parent()->AsWeakPtr();
for (ui::Layer* layer : GetLayersInOrder()) {
if (!weak_parent) break;
weak_parent->Remove(layer);
}
Alternatively, since OrphanLayers is typically called during View destruction or removal, checking the View's own validity or the parent layer's existence between iterations would mitigate the risk.
Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e
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
Likely the loop holds a raw parent pointer across a call that can synchronously run observer callbacks which destroy the parent layer, with no weak-pointer guard.
Impact
The report claims a use-after-free dereference in the unsandboxed browser process, though memory safety checks may delay reuse of the freed memory; no working exploit is shown.
What the attacker needed
Compromised renderer; a View with multiple layers; an animation observer that destroys the parent
The fix
The loop should be made re-entrancy safe, for example by tracking the parent layer with a weak pointer and stopping when it is gone.
How it was found
- Find a View that manages several layers, such as one using AddLayerToRegion.
- Start a bounds animation on one of the auxiliary layers.
- Attach an animation observer that destroys the parent View or Widget when the animation is aborted.
- Trigger a UI action from a compromised renderer that removes the child View from its parent.
- During OrphanLayers the first removal aborts the animation, the observer destroys the parent layer, and the next iteration dereferences the dangling 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.
When a program frees a piece of memory but keeps using it, that is a use-after-free. Here a function remembers where a parent layer lives, then calls code that can delete that layer, and afterwards still tries to use the remembered location. The report is a code review finding, not a demonstrated attack.
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.