← All reports

[Site Isolation] Fake mouse-move forwarding into cross-origin iframes

Component: WebKit Site Isolation | ec7db19

Source/WebKit/UIProcess/WebPageProxy.cpp

+void WebPageProxy::dispatchFakeMouseMoveEventInRemoteFrame(IPC::Connection& connection, FrameIdentifier frameID, const DoublePoint& eventPoint, const DoublePoint& globalPoint)
+{
+ RefPtr frame = WebFrameProxy::webFrame(frameID);
+ if (!frame)
+ return;
+
+ Ref process = WebProcessProxy::fromConnection(connection);
+ RefPtr parentFrame = frame->parentFrame();
+ MESSAGE_CHECK(process, frame->page() == this && parentFrame && &parentFrame->process() == process.ptr());
+
+ sendToProcessContainingFrame(frameID, Messages::WebPage::DispatchFakeMouseMoveEventInFrame(frameID, eventPoint, globalPoint));
+}

Source/WebKit/WebProcess/WebPage/WebPage.cpp

+void WebPage::dispatchFakeMouseMoveEventInFrame(WebCore::FrameIdentifier frameID, const DoublePoint& eventPoint, const DoublePoint& globalPoint)
+{
+ RefPtr frame = WebProcess::singleton().webFrame(frameID);
+ RefPtr localFrame = frame ? frame->coreLocalFrame() : nullptr;
+ if (!localFrame || !localFrame->view())
+ return;
+ CheckedRef eventHandler = localFrame->eventHandler();
+ eventHandler->setLastKnownMousePosition(eventPoint, globalPoint, LastKnownMousePositionSource::Mouse);
+ eventHandler->dispatchFakeMouseMoveEventSoon();
+}

WebKit synthesizes mouse-move events after scrolls or layout changes so :hover state stays correct under a stationary pointer, using a timer in EventHandler. Under site isolation, a cross-origin iframe is a RemoteFrame stand-in in the parent's process, so the parent cannot deliver the event itself, and the UI process must route it. A new DispatchFakeMouseMoveEventInRemoteFrame message carries the target FrameIdentifier, the transformed point and the global point to WebPageProxy. The proxy checks that the frame belongs to this page and that its parent is hosted by the sender, then relays WebPage::DispatchFakeMouseMoveEventInFrame to the owning process.

It fixes hover updates when scrolling over a cross-origin iframe with a still cursor, and adds a renderer-initiated message that lands in a different WebContent process.

Test the UI-process check against frames mid-navigation, frames swapped between processes, and provisional frames whose process() differs from the committed one. Neither side validates eventPoint or globalPoint, so NaN, infinity or huge values from a compromised parent-frame process reach the victim process's timer, hit testing and coordinate transforms. The timer later builds a MouseEventInputSource::UserDriven synthetic move, which lets a compromised parent influence hover, cursor state and event timing in a cross-origin iframe. Note the gating asymmetry: the UI-process message is EnabledBy=SiteIsolationEnabled, but the receiver in WebPage.messages.in has no EnabledBy attribute. Also check frame state between the receiver's local-frame check and the deferred timer, and lifetime between the RefPtr lookup and sendToProcessContainingFrame.