Use after free in Input (CVE-2026-16804)
A use-after-free exists in the browser's input router because a call to stop a fling can synchronously destroy the object that made the call, after which the function keeps reading its members and making virtual calls. An attacker who can reallocate the freed memory could hijack a virtual call and potentially achieve remote code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 38 days
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 browser-process Use-After-Free (UAF) vulnerability exists in InputRouterImpl::SendKeyboardEvent. Calling gesture_event_queue_.StopFling() can initiate a synchronous, re-entrant call chain that destroys the owning RenderWidgetHostImpl and the InputRouterImpl itself. Once the stack unwinds, the function proceeds to read member variables and perform virtual calls on the freed object.
Affected files:
components/input/input_router_impl.cccomponents/input/input_router_impl.h
Estimated timestamp from git blame: 2018-03-21
Root Cause Analysis
In components/input/input_router_impl.cc, InputRouterImpl::SendKeyboardEvent calls gesture_event_queue_.StopFling(), which can synchronously destroy *this via a re-entrant call chain during overscroll completion. However, after the call to StopFling(), the function continues to access member variables of this and invokes further methods without any liveness checks:
// components/input/input_router_impl.cc:150-160
void InputRouterImpl::SendKeyboardEvent(
const NativeWebKeyboardEventWithLatencyInfo& key_event,
KeyboardEventCallback event_result_callback,
DispatchToRendererCallback& dispatch_callback) {
gesture_event_queue_.StopFling(); // L154 — Re-entrant; can free *this
blink::mojom::WidgetInputHandler::DispatchEventCallback callback =
base::BindOnce(&InputRouterImpl::KeyboardEventHandled, weak_this_, // L156 — UAF read of this->weak_this_
key_event, std::move(event_result_callback));
FilterAndSendWebInputEvent(key_event.event, key_event.latency, // L158 — UAF call
std::move(callback), dispatch_callback);
}
InputRouterImpl is heap-owned via a std::unique_ptr<InputRouter> within RenderInputRouter which is in turn owned by RenderWidgetHostImpl. If RenderWidgetHostImpl is synchronously destroyed, the destructor of InputRouterImpl runs immediately, freeing its backing memory.
While sibling entry points such as InputRouterImpl::OnTouchEventAck protect against this re-entrant destruction pattern using local base::WeakPtr checks:
// components/input/input_router_impl.cc:518-522
auto weak_this = weak_ptr_factory_.GetWeakPtr();
disposition_handler_->OnTouchEventAck(event, ack_source, ack_result);
if (!weak_this) {
return;
}
SendKeyboardEvent is missing this critical guard.
Potential Attack Path and Sequence
Below are the suggested/potential steps an attacker could follow to trigger this vulnerability. Note that these are analytical steps based on static code tracing, as our tooling agent does not have the capability to run code or compile a functional proof of concept:
- Setup: The attacker serves a webpage that has at least one entry in its back-navigation history and does not consume horizontal scroll gestures (
overscroll-behavior-x: auto). - Overscroll Initialization: The user performs a horizontal touchscreen swipe past the overscroll completion threshold. This transitions
OverscrollControllerinto an active overscroll mode (OVERSCROLL_EASTorOVERSCROLL_WEST). - Fling Arming: The user lifts their finger with horizontal velocity, prompting the OS to generate a
kGestureFlingStart(GFS) event. The browser'sFlingControllerconsumes the GFS, arms itsfling_curve_, and setsfling_in_progress()totruewhile theOverscrollControllerpreserves the active overscroll state. - Event Stalling: A compromised renderer can stall the
WidgetInputHandler::DispatchEventACK reply for incoming momentum-phaseGestureScrollUpdateevents, widening the race window indefinitely. - Keyboard Input Dispatch: While the fling is active, the user presses a key. This calls
RenderWidgetHostImpl::ForwardKeyboardEventWithCommands->InputRouterImpl::SendKeyboardEvent->gesture_event_queue_.StopFling(). - Synchronous GSE & ACK:
StopFlingtriggersEndCurrentFling(), which generates a synthetic touchscreenkGestureScrollEnd(GSE) event and forwards it. Since GSE is a non-blocking event, its ACK callback runs synchronously, propagating throughOnGestureEventAck->RenderWidgetHostViewAura::GestureEventAck->OverscrollController::ReceivedEventACK->CompleteAction(). - Tab/Frame Destruction:
CompleteAction()triggersdelegate_->OnOverscrollCompletewhich requests a back/forward navigation (e.g.,controller.GoBack()). A synchronous notification during the navigation request (e.g.DidStartNavigation) triggers an observer or a throttle to synchronously close/destroy theWebContents(and thusRenderWidgetHostImplandInputRouterImpl). - Use-After-Free: The stack unwinds back to
SendKeyboardEvent(line 155). The code attempts to readthis->weak_this_(line 156) and callsFilterAndSendWebInputEvent(line 158) on the freedInputRouterImplmemory block.
Because the free occurs within the context of a base::ScopedSafetyChecksExclusion scope (instantiated during event forwarding), PartitionAlloc's Scheduler Loop Quarantine is bypassed, allowing the slot to be immediately reallocated. An attacker who has reallocated the heap slot can overwrite the this->client_ pointer to hijack the subsequent virtual call (client_->FilterInputEvent(...)) at line 650, leading to browser-process Remote Code Execution (RCE) / Sandbox Escape.
Suggested Fix
Add a base::WeakPtr check immediately after the call to StopFling() inside InputRouterImpl::SendKeyboardEvent to halt execution if this has been synchronously destroyed:
void InputRouterImpl::SendKeyboardEvent(
const NativeWebKeyboardEventWithLatencyInfo& key_event,
KeyboardEventCallback event_result_callback,
DispatchToRendererCallback& dispatch_callback) {
auto weak_this = weak_ptr_factory_.GetWeakPtr();
gesture_event_queue_.StopFling();
if (!weak_this) {
return;
}
blink::mojom::WidgetInputHandler::DispatchEventCallback callback =
base::BindOnce(&InputRouterImpl::KeyboardEventHandled, weak_this_,
key_event, std::move(event_result_callback));
FilterAndSendWebInputEvent(key_event.event, key_event.latency,
std::move(callback), dispatch_callback);
}
Evaluated with Chrome root at commit: 70c6813870b6701fa16670076bf633ee6c3a439f
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 function calls StopFling() without a liveness check afterwards, unlike sibling entry points that guard re-entrant destruction with a local weak pointer.
Impact
An attacker who reallocates the freed heap slot could overwrite a pointer and hijack a virtual call, potentially leading to browser-process remote code execution and sandbox escape; the report notes the free occurs inside a scope that bypasses the allocator's quarantine.
What the attacker needed
Victim uses a touchscreen; page has back-navigation history; page allows horizontal overscroll; compromised renderer to stall acks
The fix
A weak pointer check should be added immediately after the StopFling() call so the function returns if the object has been destroyed.
How it was found
- Serve a page with back-navigation history that does not consume horizontal overscroll gestures.
- Have the user swipe horizontally past the overscroll threshold to enter an active overscroll state.
- Have the user lift their finger with horizontal velocity so a fling gesture starts.
- Stall the acknowledgement of momentum scroll events to widen the race window.
- Have the user press a key while the fling is active, which calls StopFling and triggers a synthetic scroll-end event.
- The scroll-end acknowledgement completes the overscroll action, which requests a navigation that synchronously destroys the widget and input router.
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 an object's memory but keeps using it, that is a use-after-free. Here, a routine that stops a scrolling animation can trigger a chain of events that deletes the very object running the code, and the code then carries on as if nothing happened. If an attacker can put their own data in that freed memory, they may be able to redirect the program to run their 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.