← All reports

Site Isolation frame validation before redispatching drag and lookup requests

The UIProcess asked the renderer where to send input — and believed the answer

Component: WebKit Site Isolation | dd76abb

LayoutTests/http/tests/site-isolation/mouse-events/drag-controller-action-redispatch-to-source-frame-is-rejected.html

+ // std::optional<DragOperation>, DragHandlingMethod, bool, unsigned, two IntRects, then std::optional<RemoteUserInputEventData>.
+ const requestCount = forgeRedispatchToItself('WebPage_PerformDragControllerAction', [
+ { type: 'bool', value: 0 }, { type: 'uint8_t', value: 0 }, { type: 'bool', value: 0 }, { type: 'uint32_t', value: 0 },
+ ...
+ { type: 'bool', value: 1 }, ...remoteUserInputEventDataForThisFrame(),
+ ]);
+ ...
+ const invalidMessage = await waitForInvalidMessageString();
+ ...
+ else if (!invalidMessage.includes("Message check failed"))
+ finish("FAIL: the UI process accepted the redispatch. Invalid message: '" + invalidMessage + "'");

With Site Isolation, cross-origin frames live in separate WebContent processes and the UIProcess brokers input. For drag, immediate action (force-click/look-up) and dictionary lookup on macOS, the UIProcess sends a request to one process. If that process's hit test lands on a frame hosted elsewhere, it replies naming that frame via RemoteUserInputEventData, and the UIProcess re-sends the request to the hosting process. When the web process is compromised, that reply is attacker data.

WebPageProxy::performDragControllerAction, dragEndedInFrame, performImmediateActionHitTestAtLocation and performDictionaryLookupAtLocationInFrame now follow the reply only if frameForRemoteUserInputEventRedispatch() accepts the named frame for the replying connection; otherwise the message check fails. New layout tests and TestWebKitAPI tests forge a redispatch through the IPC testing API.

WebContent A --reply(frameID = X)--> UIProcess
                                      +-> frameForRemoteUserInputEventRedispatch(X, connA)
                                            +- accepted --> re-send to process hosting X
                                            +- rejected --> message check fails

A compromised WebContent process could previously steer the UIProcess into re-sending input-driven requests to a frame of its choosing, undermining the UIProcess's authority over frame ownership.

The pattern is a reply that carries a frame or process identity and triggers a UIProcess re-send. Hunt for other redispatch sites that use the reply's frame without frameForRemoteUserInputEventRedispatch(): other drag callbacks, text-interaction and services/lookup flows, and non-macOS equivalents. Probe what the validation accepts. Does it bind the frame to both the replying connection and the original request? Can stale or reparented frames, or frames mid-navigation or process swap, pass? The tests only forge a redispatch to the source frame itself, so redispatch to a different frame in another process, such as a sibling cross-origin iframe, deserves its own test. Request correlation is also worth a look: unsolicited replies, replayed replies, and replies arriving after the drag session ended.