Use after free in Animation (CVE-2026-7358)
A use-after-free occurs when iterating over an AnimationTrigger's backing map because synchronous promise resolution allows JavaScript to modify the map during iteration, freeing the backing store. An attacker could potentially achieve renderer remote code execution by exploiting the invalidated iterator.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 35 days
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: A potential Use-After-Free (UAF) exists when iterating over an AnimationTrigger's backing map. Synchronous resolution of a paused animation's promise allows JavaScript execution during iteration. Modifying the map from JS can shrink and free the backing store, invalidating the iterator and leading to a potential renderer RCE.
Affected files:
third_party/blink/renderer/core/animation/animation_trigger.ccthird_party/blink/renderer/core/animation/scroll_snapshot_timeline.ccthird_party/blink/renderer/core/animation/animation.cc
Estimated timestamp from git blame: 2026-01-26
Summary
A potential Use-After-Free (UAF) exists in AnimationTrigger::PerformActivate and AnimationTrigger::PerformDeactivate. These functions iterate over animation_behavior_map_ (a HeapHashMap) using a C++ range-based for loop. During iteration, PerformBehavior can trigger synchronous JavaScript execution via a promise resolution. If an attacker installs a getter on Animation.prototype.then, they can modify the map (e.g., by calling removeAnimation) during the iteration. This modification can trigger a map shrink and rehash, which immediately frees the backing store that the C++ iterator is currently traversing.
Technical Details
The vulnerability is reachable because Animation::ResolvePromiseMaybeAsync resolves promises synchronously when ScriptForbiddenScope::IsScriptForbidden() is false. The call path through LocalFrameView::ServiceScrollAnimations (via PageAnimator::ServiceScriptedAnimations during BeginMainFrame) occurs before the lifecycle update establishes such a scope.
Specifically:
AnimationTrigger::PerformActivateiteratesanimation_behavior_map_.- The loop calls
PerformBehavior->PerformReset->Animation::ResetPlayback->Animation::setCurrentTime. - If
pending_pause_is true (set via a prioranimation.pause()call),Animation::ResolvePromiseMaybeAsyncis called. - Since script is not forbidden,
promise->Resolve(this)runs synchronously. - V8's promise resolution synchronously accesses the
.thenproperty of the resolvedAnimationobject. - An attacker-defined JS getter for
Animation.prototype.thenexecutes mid-loop. - The getter repeatedly calls
trigger.removeAnimation(), triggeringanimation_behavior_map_.erase(). - If enough elements are removed, the map calls
Shrink()->Rehash(), which immediately frees the old backing store viaBlinkAllocator::FreeHashTableBackingand Oilpan'sFreeUnreferencedObject. - The JS getter returns, and the C++ loop attempts to increment the iterator (
HashTableConstIterator::operator++). - In release builds (where
CheckModifications()is compiled out), the iterator blindly reads from the freed memory. - The loop reads a fake
WeakMember<Animation>from the reallocated memory and callsHasPausedCSSPlayState(animation), which invokes the virtual methodanimation->IsCSSAnimation(), leading to a potential RCE.
Suggested Attacker Steps
(Note: These are potential steps as a working Proof-of-Concept has not yet been executed by the automated agent.)
- Create a
ScrollTimelineand severalAnimationobjects linked to it. - Associate an
AnimationTriggerwith these animations, setting the activation behavior toreset. - Call
animation.pause()on the first animation to setpending_pause_ = true. - Define a custom getter on
Animation.prototype.then. - Trigger a scroll event to activate the trigger.
- Inside the custom getter, call
trigger.removeAnimation()on the remaining animations to force a rehash and free the backing store. - Still inside the getter, perform heap spraying (e.g., allocating arrays) to reclaim the freed backing store and inject a fake
WeakMember<Animation>pointer pointing to a fake object with a forged vtable.
Other Affected Loops
Similar vulnerable patterns exist in:
AnimationTrigger::PerformDeactivateScrollSnapshotTimeline::UpdateSnapshotInternal(where it directly iterates overtrigger->BehaviorMap())
Suggested Fix
To fix this, avoid iterating directly over the HeapHashMap when synchronous script execution is possible. A common and safe pattern in Blink is to copy the elements (e.g., the Animation pointers) into a separate, temporary HeapVector before iterating and performing actions that might run script.
Alternatively, consider whether a ScriptForbiddenScope should be active during this phase of the rendering pipeline (e.g., within ServiceScrollAnimations or UpdateSnapshotInternal) to enforce asynchronous promise resolution, though this might have wider architectural implications.
Evaluated with Chrome root at commit: a3f5fcb392f2902650ca2b71820e7e418787e18b
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. Please feel free to reach out to me if you have concerns or feedback.
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 code iterates over a hash map while allowing synchronous JavaScript execution that can modify the map, invalidating the iterator and freeing the backing store.
Impact
A potential renderer remote code execution could occur, though the report notes that a working proof-of-concept has not yet been executed.
What the attacker needed
Victim visits a malicious page; browser runs vulnerable code
The fix
The code should avoid iterating directly over the HeapHashMap when synchronous script execution is possible, for example by copying elements into a temporary HeapVector before iterating.
How it was found
- Create a ScrollTimeline and several Animation objects linked to it.
- Associate an AnimationTrigger with these animations, setting the activation behavior to reset.
- Call animation.pause() on the first animation to set pending_pause_ = true.
- Define a custom getter on Animation.prototype.then.
- Trigger a scroll event to activate the trigger.
- Inside the custom getter, call trigger.removeAnimation() on the remaining animations to force a rehash and free the backing store.
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 report describes a memory safety bug in a web browser's animation code. When the browser processes a list of animations, it can run JavaScript code in the middle of that processing. That JavaScript can change the list, causing the browser to free the memory it is still reading from. This can crash the browser or, in theory, let an attacker run their own code.
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.