Medium CVSS 6.1 webkit Cross Origin 🔧 Commit mapped

Overview

Medium
Severity
6.1
CVSS
No
Exploited ITW
Fixed
Fix Status
DescriptionLoading a malicious iframe may lead to a cross-site scripting attack
ComponentWebKit UIProcess
Bug ClassCross Origin
Tracker286381
Fix commit609e8c7a932f (WebKit/WebKit) +41/-0
CWECWE-79 (Cross-site scripting)
CVSS vectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CISA KEVNot listed
CreditedMuhammad Zaid Ghifari (Mr.ZheeV) and Kalimantan Utara
Disclosed2025-03-31

Background

createNewPage / window.open
The UI-process flow that creates a new page when content calls window.open, delegating to the app’s UI client.
javascript: URL
A URL scheme whose body executes as script in the loading document’s context; loading it in the wrong context is XSS.
Single-window app
A UI client that handles window.open by loading into the existing view, which is where the javascript: URL slipped in.

Root Cause Analysis

This fixes a cross-site-scripting vector where a javascript: URL could be loaded during the window.open (createNewPage) flow. When web content calls window.open, WebPageProxy::createNewPage asks the app’s UI client to create a new page; in a single-window app the client may respond by loading the requested URL into the existing view via WebPageProxy::loadRequest. A cross-origin subframe calling window.open(‘javascript:…’) could thereby get a javascript: URL loaded through this path and executed in the opener/host page’s context — a universal/cross-site scripting condition, because the javascript: URL runs with the wrong document’s origin rather than being blocked.

The fix adds an m_isCallingCreateNewPage flag: it is set true immediately before invoking the UI client’s createNewPage and cleared in the createNewPage completion handler, and WebPageProxy::loadRequest now returns nullptr (refusing the load) when m_isCallingCreateNewPage is true and request.url().protocolIsJavaScript().

The restored invariant is that javascript: URLs cannot be loaded through the createNewPage window. The regression test loads a javascript: URL via window.open from a cross-origin iframe and expects the loadRequest to be refused (NULL).

Key insight
A javascript: URL passed to window.open could be loaded through the createNewPage path and execute in the wrong origin; refusing javascript: loads while createNewPage is in progress blocks the XSS.

Attack Path

  1. Embed a cross-origin iframe A page loads a cross-origin subframe.
  2. Call window.open('javascript:...') The subframe calls window.open with a javascript: URL.
  3. Load during createNewPage The single-window UI client responds by calling loadRequest with the javascript: URL during createNewPage.
  4. Cross-site script execution The javascript: URL executes in the host/opener page’s context, a cross-site scripting attack.

Impact Assessment

A cross-site scripting condition in the WebContent process reachable from a crafted iframe via window.open, letting attacker script run in another origin’s context — a serious same-origin-policy bypass. No memory corruption; the impact is universal XSS gated by the app’s window.open handling.

Changed Functions

FunctionChangeNotes
WebPageProxy::loadRequest
Source/WebKit/UIProcess/WebPageProxy.cpp
modified Returns nullptr for a javascript: URL while m_isCallingCreateNewPage is true, blocking the load during the window.open flow.
WebPageProxy::createNewPage
Source/WebKit/UIProcess/WebPageProxy.cpp
modified Sets m_isCallingCreateNewPage around the UI client's createNewPage call and clears it in the completion handler.
WebPageProxy::m_isCallingCreateNewPage
Source/WebKit/UIProcess/WebPageProxy.h
modified New flag marking the window that a javascript: URL must not be loaded through.

Files Changed

  • Source/WebKit/UIProcess/WebPageProxy.cpp
  • Source/WebKit/UIProcess/WebPageProxy.h
  • Tools/TestWebKitAPI/Tests/WebKitCocoa/OpenAndCloseWindow.mm

Audit Directions

  • javascript: URL entry points
    Grep WebPageProxy for loadRequest/loadData paths that can receive a protocolIsJavaScript() URL from content without an origin/context gate.
  • createNewPage side effects
    Audit the createNewPage / UI-client flow for other requests that can be loaded into the host page during window.open.

Original Bug Report

The reporter's bug is still restricted on the tracker.