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

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.cc
  • third_party/blink/renderer/core/animation/scroll_snapshot_timeline.cc
  • third_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:

  1. AnimationTrigger::PerformActivate iterates animation_behavior_map_.
  2. The loop calls PerformBehavior -> PerformReset -> Animation::ResetPlayback -> Animation::setCurrentTime.
  3. If pending_pause_ is true (set via a prior animation.pause() call), Animation::ResolvePromiseMaybeAsync is called.
  4. Since script is not forbidden, promise->Resolve(this) runs synchronously.
  5. V8's promise resolution synchronously accesses the .then property of the resolved Animation object.
  6. An attacker-defined JS getter for Animation.prototype.then executes mid-loop.
  7. The getter repeatedly calls trigger.removeAnimation(), triggering animation_behavior_map_.erase().
  8. If enough elements are removed, the map calls Shrink() -> Rehash(), which immediately frees the old backing store via BlinkAllocator::FreeHashTableBacking and Oilpan's FreeUnreferencedObject.
  9. The JS getter returns, and the C++ loop attempts to increment the iterator (HashTableConstIterator::operator++).
  10. In release builds (where CheckModifications() is compiled out), the iterator blindly reads from the freed memory.
  11. The loop reads a fake WeakMember<Animation> from the reallocated memory and calls HasPausedCSSPlayState(animation), which invokes the virtual method animation->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.)

  1. Create a ScrollTimeline and several Animation objects linked to it.
  2. Associate an AnimationTrigger with these animations, setting the activation behavior to reset.
  3. Call animation.pause() on the first animation to set pending_pause_ = true.
  4. Define a custom getter on Animation.prototype.then.
  5. Trigger a scroll event to activate the trigger.
  6. Inside the custom getter, call trigger.removeAnimation() on the remaining animations to force a rehash and free the backing store.
  7. 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::PerformDeactivate
  • ScrollSnapshotTimeline::UpdateSnapshotInternal (where it directly iterates over trigger->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.

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 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

  1. Create a ScrollTimeline and several Animation objects linked to it.
  2. Associate an AnimationTrigger with these animations, setting the activation behavior to reset.
  3. Call animation.pause() on the first animation to set pending_pause_ = true.
  4. Define a custom getter on Animation.prototype.then.
  5. Trigger a scroll event to activate the trigger.
  6. 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.

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.