Skip to content
XSS Advisory Advanced CVE-2026-95291

UI misrepresentation in SecurityIndicators (CVE-2026-95291)

Chrome on iOS used a deprecated origin helper that returns an empty origin for blob: URLs, so three same-origin checks on the history.replaceState path all compared empty to empty and passed. A web page could then make the address bar show an arbitrary attacker-chosen hostname while displaying its own content.

NH DEV Follow

Originally disclosed on Chrome VRP

Bounty$5,000 High View original
  • Fix shipped in 47 days

Security Bug

VULNERABILITY DETAILS

GURL::DeprecatedGetOriginAsURL() returns an empty GURL() for any URL whose scheme is not in the standard-schemes list (url/gurl.cc:255-259; blob is absent from url/url_util.cc:50-64). Chrome on iOS uses this function as the same-origin predicate at three points on the history.replaceState → omnibox display path. When both operands are blob: URLs, both sides evaluate to empty → equal, regardless of the inner origin. A web page can therefore navigate to its own blob: URL, then post a crafted didReplaceState message directly to the page-world NavigationEventMessage script-message handler with pageUrl='blob:https://<any-hostname>/…', and all three checks pass.

The iOS steady-state location bar (components/omnibox/browser/location_bar_model_impl.cc:123-133, IS_IOS-only) then rewrites the resulting blob: VirtualURL via url::Origin::Create() — which parses the inner URL (url/origin.cc:46-51) — and formats with kFormatUrlOmitHTTPS | kFormatUrlTrimAfterHost. The address bar displays the bare attacker-chosen hostname over attacker- controlled document content.

The three defeated checks

# Site Predicate Both-blob result
G1 ios/web/history_state_util.cc:19-20 IsHistoryStateChangeValid to_url.DeprecatedGetOriginAsURL() == current_url.DeprecatedGetOriginAsURL() empty == empty → passes
G2 ios/web/navigation/crw_js_navigation_handler.mm:165-166 (second call) IsHistoryStateChangeValid(navItem->GetURL(), replaceURL) empty == empty → passes
G3 ios/web/navigation/navigation_manager_impl.mm:1403-1417 CanTrustLastCommittedItem GetVisibleWebViewOriginURL() (= GURLWithNSURL(WKWebView.URL).DGOAU(), :1499) == last_committed_url.DGOAU() empty == empty → true → spoofed item returned by GetLastCommittedItemImpl() :872 → GetVisibleItem()

Not a missing check — three checks are present; each uses a representation that collapses blob: to a single equivalence class.

Bypassing WebKit's own guard

Chrome's navigation.ts wraps History.prototype.replaceState and calls originalWindowHistoryReplaceState.call(...) before posting didReplaceState (ios/web/navigation/resources/ navigation.ts:127-146) — so the JS-API path is protected by WebKit's built-in same-origin check on replaceState. The attack posts to window.webkit.messageHandlers.NavigationEventMessage directly, so WebKit's check never runs. This is reachable because:

  • NavigationJavaScriptFeature registers in ContentWorld::kPageContentWorld (ios/web/navigation/navigation_java_script_feature.mm:33), which is WKContentWorld.pageWorld (ios/web/js_messaging/java_script_feature_manager.mm:66-67);
  • the raw handler name "NavigationEventMessage" is registered in that world with no obfuscation (ios/web/js_messaging/java_script_content_world.mm:276-293);
  • ShouldHandleMessageFromOrigin defaults to OriginFilter::kPublic (ios/web/public/js_messaging/java_script_feature.h:268 → java_script_feature.mm:283-284) — accepts any origin;
  • the frame_id gate (navigation_java_script_feature.mm:80-88) requires the page-world main-frame ID, which is readable from page JS via window.__gCrWeb.getFrameId() (ios/web/public/js_messaging/resources/gcrweb.ts:56,166-168 — __gCrWeb is attached to the page-world window);
  • is_main_frame() (:66) is satisfied — the attack runs in the main frame.

The frame_id gate has a timing dependency: the browser's WebFramesManager learns the blob document's frameId via a FrameBecameAvailable message that native code triggers via registerFrame() after commit (ios/web/public/js_messaging/resources/gcrweb.ts:66-75; comment at :80-82: "needs to be called by the native application on each navigation"). A script running at document-parse time posts before that registration lands, so its frame_id mismatches the browser's still-stale main-frame ID and is dropped at :86. The attached PoC calls window.__gCrWeb.registerFrame() explicitly and retries the post at 150/500/1200ms; the spoof reliably lands on the delayed attempts.

Write path

crw_js_navigation_handler.mm:127-183 handleNavigationDidReplaceStateMessage: GetHistoryStateChangeUrl(currentURL, GURL(baseUrl), pageUrl) (:147) → base_url.Resolve(pageUrl) returns pageUrl (absolute) → IsHistoryStateChangeValid (G1) → URLEscapedForHistory → replaceURL.is_valid() (blob:https://… is valid) → G2 → replaceStateWithPageURL (:222) → NavigationManagerImpl::UpdateCurrentItemForReplaceState → navigation_manager_impl.mm:628-635 SetURL(url) on the current item. NavigationItemImpl::GetVirtualURL() (navigation_item_impl.mm:178-180) returns url_ when virtual_url_ is empty (it is — SetURL doesn't touch it).

Non-defenses examined

  • crw_web_view_navigation_observer.mm:400-411 has an originAsURL.is_empty() early-reject — but that's the WKWebView.URL KVO path. Direct handler invocation doesn't change WKWebView.URL, so KVO never fires.
  • CanTrustLastCommittedItem :1404-1408,:1421-1425 early-returns true for about:/file:/app-specific — blob: isn't listed and falls through to the empty==empty comparison.
  • crw_js_navigation_handler.mm:139 DCHECK(changingHistoryState) is DCHECK-only, and satisfiable via a preceding willChangeState message anyway.
  • :151 !replaceURL.is_valid() — blob:https://… is valid.
  • :159-162 GetItemCount() <= 1 && navItem->GetURL().is_empty() — blob-doc's navItem URL is the (non-empty) blob URL.

VERSION

Chrome for iOS: 151.0.7922.112 (App Store, stable channel)

iOS: 26.3

Source examined at chromium/src origin/main @ 98caa88046 (2026-08-04). IsHistoryStateChangeValid predicate unchanged since 800532c0bf (2021-10-14, GetOrigin()→DeprecatedGetOriginAsURL() rename) per GitHub-mirror history.

REPRODUCTION CASE

Attachments: poc_server.py, observed.png.

  1. On any host reachable from the test iPhone:

    python3 poc_server.py
    
  2. On the iPhone, open Chrome and navigate to http://<host-ip>:8080/.

  3. The launcher page navigates to a blob:http://<host-ip>:8080/ <uuid> document, which reads window.__gCrWeb.getFrameId(), calls window.__gCrWeb.registerFrame(), and posts willChangeState + didReplaceState{pageUrl: 'blob:https://accounts.google.com/signin', baseUrl:'https://x/', stateObject:'', frame_id:<id>} directly to window.webkit.messageHandlers.NavigationEventMessage, retrying at 150/500/1200ms.

OBSERVED (bug present)

The steady-state address bar displays accounts.google.com (bare hostname, no blob: prefix) while the tab's content is the attacker-controlled document. Screenshot: observed.png.

The on-page diagnostic log confirms the real location.href is blob:http://<host-ip>:8080/<uuid> and location.origin is the attacker's origin.

EXPECTED

Any of:

  • IsHistoryStateChangeValid compares via url::Origin::Create(url) (which correctly extracts the inner origin for blob:) instead of DeprecatedGetOriginAsURL();
  • NavigationEventMessage handler moves to ContentWorld::kIsolatedWorld, or the didPushState/ didReplaceState messages carry an isolated-world-only nonce, so page JS cannot forge them;
  • CanTrustLastCommittedItem treats an empty DGOAU() on either side as untrusted (the KVO path at crw_web_view_navigation_observer.mm:407-411 already does).

ROOT CAUSE

url/gurl.cc:255-259 DeprecatedGetOriginAsURL(): if (!is_valid_ || !IsStandard()) return GURL(); — blob is non-standard
ios/web/history_state_util.cc:19-20 Same-origin predicate uses DGOAU() equality
ios/web/navigation/navigation_java_script_feature.mm:33 kPageContentWorld — handler in page world
ios/web/public/js_messaging/resources/gcrweb.ts:166-168 window.__gCrWeb in page world → frame_id readable
ios/web/navigation/navigation_manager_impl.mm:1403-1417 Reconciliation predicate uses DGOAU() equality
components/omnibox/browser/location_bar_model_impl.cc:123-133 IS_IOS: blob → url::Origin::Create → inner origin displayed

SUGGESTED FIX

Replace DeprecatedGetOriginAsURL() with url::Origin::Create() in IsHistoryStateChangeValid and CanTrustLastCommittedItem (and the KVO-path helper for consistency). url::Origin::Create handles blob:/filesystem: inner-URL extraction and opaque-origin nonce comparison correctly. Six call-sites in //ios/web use DGOAU() as a same-origin predicate on navigable URLs; all are candidates for the same replacement.

Independently, NavigationJavaScriptFeature in kPageContentWorld with a page-readable frame_id means page JS can forge any of its messages (hashchange, didPushState, didReplaceState) — moving to isolated world (as several other //ios/web features already are) closes the direct-invocation path regardless of the origin-comparison fix.

SECURITY IMPACT

Reachable from arbitrary web content with a stock renderer, no non-default flags, no user gesture. Any web page can cause the Chrome-on-iOS steady-state address bar to display an arbitrary attacker-chosen hostname over attacker-controlled document content, which is the canonical address-bar-spoof primitive for phishing.

Bounded: iOS only (desktop/Android use a different navigation architecture with no WKScriptMessageHandler path; the location_bar_model_impl.cc blob-strip is IS_IOS-gated). The displayed URL retains no attacker-visible artifact once steady-state formatting applies. document.location/document.origin inside the page still reflect the attacker's real blob origin, so same-origin DOM access to the spoofed origin is not gained — this is a display spoof, not a SOP bypass.

This is an address-bar hostname spoof, arbitrary target, no user interaction, on shipping stable.

RELATED

  • DeprecatedGetOriginAsURL() is documented-deprecated (url/gurl.h) with a migration TODO. The //ios/web navigation path is distinguished from most other callers by having both comparison operands be page-navigable URLs with no is_valid() or SchemeIsHTTPOrHTTPS() pre-gate.
  • crbug.com/40624624 — in-tree TODO to move pushState/replaceState logic into NavigationManager.
  • crbug.com/41354482 — in-tree TODO on the navigation.ts History.prototype interception; notes the interception exists for DidStartLoading compatibility.

CREDIT

NH DEV

The original report as published on the Chromium issue tracker, by NH DEV. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

Chrome on iOS keeps its own navigation stack in //ios/web rather than reusing the desktop or Android architecture. One of the things that stack has to do is decide whether a history.pushState or history.replaceState call is allowed to change the URL that the browser associates with the current navigation item. On iOS that decision is made in native code, driven by messages that injected JavaScript posts to the browser through WKScriptMessageHandler.

The same stack also feeds the steady-state location bar. On iOS, components/omnibox/browser/location_bar_model_impl.cc has an IS_IOS-only branch that rewrites a blob: virtual URL through url::Origin::Create() and formats the result with kFormatUrlOmitHTTPS | kFormatUrlTrimAfterHost. In normal use that means a blob document shows the origin it was created from.

The report describes a way to make that location bar display an arbitrary attacker-chosen hostname while the tab still holds attacker-controlled content. It is a display spoof, not a same-origin policy bypass.

Setup

The report lists Chrome for iOS 151.0.7922.112 (App Store, stable channel) and iOS 26.3. with source at chromium/src origin/main @ 98caa88046 (2026-08-04). The IsHistoryStateChangeValid predicate is noted as unchanged since 800532c0bf (2021-10-14, the GetOrigin() to DeprecatedGetOriginAsURL() rename) according to GitHub-mirror history.

No non-default flags and no user gesture are needed. The reproduction uses a Python server on any host reachable from the iPhone, and Chrome on the iPhone is pointed at it.

Finding it

The starting observation is in GURL::DeprecatedGetOriginAsURL() (url/gurl.cc:255-259): it returns an empty GURL() for any URL whose scheme is not in the standard-schemes list, and blob is absent from that list (url/url_util.cc:50-64).

Chrome on iOS uses this function as the same-origin predicate at three points on the history.replaceState to omnibox display path. When both operands are blob: URLs, both sides evaluate to empty, so they compare equal regardless of the inner origin. That is the whole bug: the checks are present, but each uses a representation that collapses blob: into a single equivalence class.

The three defeated checks

# Site Predicate Both-blob result
G1 ios/web/history_state_util.cc:19-20 IsHistoryStateChangeValid to_url.DeprecatedGetOriginAsURL() == current_url.DeprecatedGetOriginAsURL() empty == empty, passes
G2 ios/web/navigation/crw_js_navigation_handler.mm:165-166 (second call) IsHistoryStateChangeValid(navItem->GetURL(), replaceURL) empty == empty, passes
G3 ios/web/navigation/navigation_manager_impl.mm:1403-1417 CanTrustLastCommittedItem GetVisibleWebViewOriginURL() (= GURLWithNSURL(WKWebView.URL).DGOAU(), :1499) == last_committed_url.DGOAU() empty == empty, true, so the spoofed item is returned by GetLastCommittedItemImpl() :872 and then GetVisibleItem()

Exploitation

Step 1: get onto a blob document

A web page can navigate to its own blob: URL, so the current navigation item's URL is a blob: URL.

Step 2: post the message directly

Chrome's navigation.ts wraps History.prototype.replaceState and calls originalWindowHistoryReplaceState.call(...) before posting didReplaceState (ios/web/navigation/resources/navigation.ts:127-146). The JS-API path is therefore protected by WebKit's built-in same-origin check on replaceState.

The attack does not use that path. It posts to window.webkit.messageHandlers.NavigationEventMessage directly, so WebKit's check never runs. This is reachable because:

  • NavigationJavaScriptFeature registers in ContentWorld::kPageContentWorld (ios/web/navigation/navigation_java_script_feature.mm:33), which is WKContentWorld.pageWorld (ios/web/js_messaging/java_script_feature_manager.mm:66-67).
  • The raw handler name "NavigationEventMessage" is registered in that world with no obfuscation (ios/web/js_messaging/java_script_content_world.mm:276-293).
  • ShouldHandleMessageFromOrigin defaults to OriginFilter::kPublic (ios/web/public/js_messaging/java_script_feature.h:268 to java_script_feature.mm:283-284), which accepts any origin.
  • The frame_id gate (navigation_java_script_feature.mm:80-88) requires the page-world main-frame ID, which is readable from page JS via window.__gCrWeb.getFrameId() (ios/web/public/js_messaging/resources/gcrweb.ts:56,166-168; __gCrWeb is attached to the page-world window).
  • is_main_frame() (:66) is satisfied because the attack runs in the main frame.

The frame_id gate has a timing dependency. The browser's WebFramesManager learns the blob document's frameId via a FrameBecameAvailable message that native code triggers via registerFrame() after commit (ios/web/public/js_messaging/resources/gcrweb.ts:66-75; the comment at :80-82 says it "needs to be called by the native application on each navigation"). A script running at document-parse time posts before that registration lands, so its frame_id mismatches the browser's still-stale main-frame ID and is dropped at :86. The PoC calls window.__gCrWeb.registerFrame() explicitly and retries the post at 150/500/1200ms; the spoof reliably lands on the delayed attempts.

Step 3: run the PoC server and open the launcher

On any host reachable from the test iPhone:

Bash
python3 poc_server.py

On the iPhone, open Chrome and navigate to http://<host-ip>:8080/.

The launcher page navigates to a blob:http://<host-ip>:8080/<uuid> document, which reads window.__gCrWeb.getFrameId(), calls window.__gCrWeb.registerFrame(), and posts willChangeState plus didReplaceState directly to window.webkit.messageHandlers.NavigationEventMessage, retrying at 150/500/1200ms. The message carries:

Text
pageUrl: 'blob:https://accounts.google.com/signin', baseUrl:'https://x/', stateObject:'', frame_id:<id>

Step 4: the write path

crw_js_navigation_handler.mm:127-183 handleNavigationDidReplaceStateMessage processes the message:

  1. GetHistoryStateChangeUrl(currentURL, GURL(baseUrl), pageUrl) (:147).
  2. base_url.Resolve(pageUrl) returns pageUrl because it is absolute.
  3. IsHistoryStateChangeValid (G1) passes.
  4. URLEscapedForHistory runs.
  5. replaceURL.is_valid() (blob:https://... is valid).
  6. G2 passes.
  7. replaceStateWithPageURL (:222).
  8. NavigationManagerImpl::UpdateCurrentItemForReplaceState.
  9. navigation_manager_impl.mm:628-635 SetURL(url) on the current item.

NavigationItemImpl::GetVirtualURL() (navigation_item_impl.mm:178-180) returns url_ when virtual_url_ is empty, and it is empty because SetURL does not touch it.

Step 5: the location bar rewrites the blob URL

The iOS steady-state location bar (components/omnibox/browser/location_bar_model_impl.cc:123-133, IS_IOS-only) rewrites the resulting blob: VirtualURL via url::Origin::Create(), which parses the inner URL (url/origin.cc:46-51), and formats with kFormatUrlOmitHTTPS | kFormatUrlTrimAfterHost. The address bar displays the bare attacker-chosen hostname over attacker-controlled document content.

Observed result

The steady-state address bar displays accounts.google.com (bare hostname, no blob: prefix) while the tab's content is the attacker-controlled document. The on-page diagnostic log confirms the real location.href is blob:http://<host-ip>:8080/<uuid> and location.origin is the attacker's origin.

Root cause

url/gurl.cc:255-259 DeprecatedGetOriginAsURL(): if (!is_valid_ || !IsStandard()) return GURL();, and blob is non-standard
ios/web/history_state_util.cc:19-20 Same-origin predicate uses DGOAU() equality
ios/web/navigation/navigation_java_script_feature.mm:33 kPageContentWorld, handler in page world
ios/web/public/js_messaging/resources/gcrweb.ts:166-168 window.__gCrWeb in page world, so frame_id is readable
ios/web/navigation/navigation_manager_impl.mm:1403-1417 Reconciliation predicate uses DGOAU() equality
components/omnibox/browser/location_bar_model_impl.cc:123-133 IS_IOS: blob to url::Origin::Create to inner origin displayed

Non-defences examined

  • crw_web_view_navigation_observer.mm:400-411 has an originAsURL.is_empty() early-reject, but that is the WKWebView.URL KVO path. Direct handler invocation does not change WKWebView.URL, so KVO never fires.
  • CanTrustLastCommittedItem :1404-1408,:1421-1425 early-returns true for about:/file:/app-specific. blob: is not listed and falls through to the empty==empty comparison.
  • crw_js_navigation_handler.mm:139 DCHECK(changingHistoryState) is DCHECK-only, and satisfiable via a preceding willChangeState message anyway.
  • :151 !replaceURL.is_valid(): blob:https://... is valid.
  • :159-162 GetItemCount() <= 1 && navItem->GetURL().is_empty(): the blob document's navItem URL is the (non-empty) blob URL.

Impact

Reachable from arbitrary web content with a stock renderer, no non-default flags and no user gesture. Any web page can cause the Chrome-on-iOS steady-state address bar to display an arbitrary attacker-chosen hostname over attacker-controlled document content, which is the canonical address-bar-spoof primitive for phishing.

The impact is bounded. It is iOS only: desktop and Android use a different navigation architecture with no WKScriptMessageHandler path, and the location_bar_model_impl.cc blob-strip is IS_IOS-gated. The displayed URL retains no attacker-visible artifact once steady-state formatting applies. document.location/document.origin inside the page still reflect the attacker's real blob origin, so same-origin DOM access to the spoofed origin is not gained. This is a display spoof, not a SOP bypass.

Fix

Any of the following would close it:

  • IsHistoryStateChangeValid compares via url::Origin::Create(url) (which correctly extracts the inner origin for blob:) instead of DeprecatedGetOriginAsURL().
  • The NavigationEventMessage handler moves to ContentWorld::kIsolatedWorld, or the didPushState/didReplaceState messages carry an isolated-world-only nonce, so page JS cannot forge them.
  • CanTrustLastCommittedItem treats an empty DGOAU() on either side as untrusted, as the KVO path at crw_web_view_navigation_observer.mm:407-411 already does.

The suggested fix is to replace DeprecatedGetOriginAsURL() with url::Origin::Create() in IsHistoryStateChangeValid and CanTrustLastCommittedItem (and the KVO-path helper for consistency). url::Origin::Create handles blob:/filesystem: inner-URL extraction and opaque-origin nonce comparison correctly. Six call-sites in //ios/web use DGOAU() as a same-origin predicate on navigable URLs; all are candidates for the same replacement.

Independently, NavigationJavaScriptFeature in kPageContentWorld with a page-readable frame_id means page JS can forge any of its messages (hashchange, didPushState, didReplaceState). Moving to isolated world, as several other //ios/web features already are, closes the direct-invocation path regardless of the origin-comparison fix.

Related in-tree notes: DeprecatedGetOriginAsURL() is documented-deprecated (url/gurl.h) with a migration TODO, and the //ios/web navigation path is distinguished from most other callers by having both comparison operands be page-navigable URLs with no is_valid() or SchemeIsHTTPOrHTTPS() pre-gate. crbug.com/40624624 is an in-tree TODO to move pushState/replaceState logic into NavigationManager, and crbug.com/41354482 is an in-tree TODO on the navigation.ts History.prototype interception, noting the interception exists for DidStartLoading compatibility.

  1. Other non-standard schemes in the same predicate. Try filesystem: and other schemes absent from url/url_util.cc:50-64 wherever DGOAU() is used as a same-origin check. A positive result is two different inner origins comparing equal, or an empty origin being accepted as trusted.
  2. Other page-world message handlers. Look for NavigationJavaScriptFeature-style features registered in kPageContentWorld with OriginFilter::kPublic and a page-readable frame_id. A positive result is a forged message from page JS that changes native state.
  3. Timing on the frame_id gate. Post at document-parse time and again after calling registerFrame(), with retries. A positive result is the message being accepted on a delayed attempt after being dropped on the first.
  4. KVO versus direct invocation. Check whether a candidate path relies on WKWebView.URL KVO for its guard. A positive result is a state change that never touches WKWebView.URL, so the KVO early-reject never runs.
  5. CanTrustLastCommittedItem early-returns. Test schemes in the about:/file:/app-specific allowlist and schemes outside it. A positive result is a scheme that falls through to the empty==empty comparison and returns true.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 17 min read.

What happened, in plain words

Chrome on iPhone (Chrome for iOS) has a strip at the top of the window called the address bar, or location bar. It shows the address of the page you are looking at. People trust it: if it says accounts.google.com, most people assume they are on Google's site.

This report shows a way for arbitrary web content to make that address bar show a hostname the attacker picked, for example accounts.google.com, while the page you are actually looking at is the attacker's own page. The page does not need you to click anything, does not need special settings, and works on the normal, shipping version of Chrome from the App Store.

It is important to be clear about what this is and is not. It is a display spoof: the address bar lies about where you are. It is not a way to read Google's data or log in as you on Google. The page's own idea of its address (what JavaScript inside the page sees) still says it is the attacker's page. So this is a phishing tool, not a break-in.

To understand how, you need a few ideas first. They are explained as they come up, and collected again in the glossary at the end.

Background: how Chrome on iOS is built

Chrome on iPhone does not reuse the same internal machinery as Chrome on a desktop or on Android. It has its own navigation stack, kept in a part of the source tree called //ios/web. "Navigation stack" just means the code that tracks where the browser is, which page is loaded, and what the address bar should say.

On iPhone, the part that actually draws web pages is Apple's WebKit engine, wrapped in a component called WKWebView. Chrome's own code sits around it. Because the page-drawing part belongs to Apple, Chrome has to talk to it through Apple's interfaces, and one of those interfaces is WKScriptMessageHandler: a channel that lets JavaScript running inside a page send a message to the native (Objective-C/Swift) code of the app.

Two jobs of that stack matter here:

  1. Deciding whether a page may change its own address. Web pages can call JavaScript functions called history.pushState and history.replaceState. These let a page change the URL shown for the current history entry without actually loading a new document. This is normal and used by many sites. The browser has to check that a page is not using this to claim an address it does not own. On iOS, that check is made in native code, triggered by messages the injected JavaScript sends to the browser.

  2. Feeding the address bar. The address bar is drawn from a model in components/omnibox/browser/location_bar_model_impl.cc. On iOS there is a branch marked IS_IOS (meaning: only compiled for iOS) that handles blob: URLs specially. It rewrites them through a function called url::Origin::Create() and formats the result with two flags, kFormatUrlOmitHTTPS | kFormatUrlTrimAfterHost. In normal use this means a blob document shows the origin it was created from.

What a blob URL is

A blob: URL is a way for a page to create a chunk of content in memory and give it an address, without a server. It looks like blob:https://example.com/some-random-id. The part after blob: is the address of the page that created it (here https://example.com), followed by an identifier. The browser treats the blob as belonging to the origin of the page that made it.

"Origin" is the security boundary of the web: the combination of scheme (https), host (example.com) and port. Two pages with the same origin may read each other's data; pages with different origins may not. This rule is called the same-origin policy (SOP).

What a scheme is

The bit before the colon in a URL is the scheme: https, http, file, about, blob, filesystem. Browsers keep a list of "standard" schemes. blob is not on that list.

The finding

The starting point is a function called GURL::DeprecatedGetOriginAsURL(), defined in url/gurl.cc:255-259. GURL is Chrome's internal type for a URL. This function is supposed to return the origin part of a URL. But for any URL whose scheme is not in the standard-schemes list, it returns an empty GURL(), that is, a URL object with nothing in it. And blob is absent from that list (url/url_util.cc:50-64).

So for every blob: URL, this function returns "nothing".

Chrome on iOS uses this function as its same-origin test at three points along the path from history.replaceState to what the address bar shows. When both URLs being compared are blob: URLs, both sides come out empty, and empty equals empty. The check passes, no matter what the real inner origins are.

That is the whole bug. The checks are not missing. Three checks are present. But each one uses a representation that turns every blob: URL into the same value, so they cannot tell two different blob origins apart.

The three defeated checks

# Where it lives What it compares Result when both sides are blob URLs
G1 ios/web/history_state_util.cc:19-20, function IsHistoryStateChangeValid to_url.DeprecatedGetOriginAsURL() == current_url.DeprecatedGetOriginAsURL() empty == empty, so it passes
G2 ios/web/navigation/crw_js_navigation_handler.mm:165-166 (second call) IsHistoryStateChangeValid(navItem->GetURL(), replaceURL) empty == empty, so it passes
G3 ios/web/navigation/navigation_manager_impl.mm:1403-1417, function CanTrustLastCommittedItem GetVisibleWebViewOriginURL() (which is GURLWithNSURL(WKWebView.URL).DGOAU(), at :1499) == last_committed_url.DGOAU() empty == empty, so it returns true, and the spoofed item is handed back by GetLastCommittedItemImpl() at :872, then by GetVisibleItem()

DGOAU() in the table is shorthand for DeprecatedGetOriginAsURL(). navItem means "navigation item", the browser's record of one entry in the tab's history. WKWebView.URL is the address WebKit itself believes the view is showing.

How the attack works, step by step

Step 1: get onto a blob document

The attacker's page first navigates to its own blob: URL. From that moment, the current navigation item's URL is a blob: URL. That is the setup that makes both sides of the comparisons above come out empty.

Why do this? Because the bug only appears when both URLs being compared are blob URLs. The attacker needs the browser's current address to be a blob address before sending the forged message.

Step 2: post the message directly, skipping WebKit's own guard

Chrome's own JavaScript file navigation.ts wraps History.prototype.replaceState (it replaces the browser's built-in function with its own version) and calls originalWindowHistoryReplaceState.call(...) before posting the didReplaceState message (ios/web/navigation/resources/navigation.ts:127-146). Because the real WebKit function runs first, the normal JavaScript route is protected by WebKit's built-in same-origin check on replaceState: WebKit itself refuses a cross-origin change.

The attack does not use that route. It posts to window.webkit.messageHandlers.NavigationEventMessage directly, so WebKit's check never runs. The message arrives at Chrome's native code as if it had come from the legitimate wrapper.

This is possible because of five properties of how the handler is set up:

  • NavigationJavaScriptFeature registers in ContentWorld::kPageContentWorld (ios/web/navigation/navigation_java_script_feature.mm:33), which is the same as WKContentWorld.pageWorld (ios/web/js_messaging/java_script_feature_manager.mm:66-67). A "content world" is an isolated JavaScript environment inside the same page. The "page world" is the one the page's own scripts run in, so anything registered there is reachable by the page.
  • The raw handler name "NavigationEventMessage" is registered in that world with no obfuscation (ios/web/js_messaging/java_script_content_world.mm:276-293). In other words, the page can simply guess and use the name.
  • ShouldHandleMessageFromOrigin defaults to OriginFilter::kPublic (ios/web/public/js_messaging/java_script_feature.h:268 to java_script_feature.mm:283-284), which accepts messages from any origin.
  • The frame_id gate (navigation_java_script_feature.mm:80-88) requires the page-world main-frame ID. That ID is readable from page JavaScript via window.__gCrWeb.getFrameId() (ios/web/public/js_messaging/resources/gcrweb.ts:56,166-168), because __gCrWeb is attached to the page-world window. A "frame" is one document inside the browser window; the "main frame" is the top-level document. The frame_id is a number the browser uses to check the message came from the right frame.
  • is_main_frame() (at :66) is satisfied, because the attack runs in the main frame.

The timing problem with frame_id

The frame_id gate has a timing dependency. The browser's WebFramesManager learns the blob document's frameId through a FrameBecameAvailable message, which native code triggers by calling registerFrame() after the new document has been committed (ios/web/public/js_messaging/resources/gcrweb.ts:66-75; the comment at :80-82 says it "needs to be called by the native application on each navigation").

A script that runs while the document is still being parsed posts its message before that registration has landed. Its frame_id then does not match the browser's still-stale main-frame ID, and the message is dropped at :86.

The proof of concept works around this by calling window.__gCrWeb.registerFrame() explicitly and retrying the post at 150, 500 and 1200 milliseconds. The spoof reliably lands on the delayed attempts.

Why retry? Because the first attempt is expected to fail while the browser catches up. Retrying later, after registration, gives the message a matching ID.

Step 3: run the proof-of-concept server and open the launcher

On any host reachable from the test iPhone:

Bash
python3 poc_server.py

This starts a small Python web server on the machine. python3 runs the Python interpreter, and poc_server.py is the script that serves the attacker's pages. The iPhone must be able to reach that machine over the network, which is why the report says "any host reachable from the test iPhone".

On the iPhone, open Chrome and navigate to http://<host-ip>:8080/. Here <host-ip> stands for the network address of the machine running the server, and 8080 is the port the script listens on. This loads the launcher page.

The launcher page navigates to a blob:http://<host-ip>:8080/<uuid> document. That document reads window.__gCrWeb.getFrameId(), calls window.__gCrWeb.registerFrame(), and posts willChangeState plus didReplaceState directly to window.webkit.messageHandlers.NavigationEventMessage, retrying at 150, 500 and 1200 milliseconds. The message carries:

Text
pageUrl: 'blob:https://accounts.google.com/signin', baseUrl:'https://x/', stateObject:'', frame_id:<id>

Line by line:

  • pageUrl is the address the attacker wants the browser to believe the page now has. It is a blob URL whose inner origin is https://accounts.google.com, with the path /signin. This is the hostname that will end up in the address bar.
  • baseUrl is https://x/. Because the pageUrl above is already absolute, base_url.Resolve(pageUrl) returns it unchanged.
  • stateObject is the history state object, the data a page can attach to a history entry. Here it is an empty string.
  • frame_id is the ID read from window.__gCrWeb.getFrameId(), so the browser accepts the message as coming from the right frame.

willChangeState is a companion message; sending it first satisfies the DCHECK-only changingHistoryState assertion later in the native code.

Step 4: what the browser does with the message (the write path)

The native function handleNavigationDidReplaceStateMessage in crw_js_navigation_handler.mm:127-183 processes the message:

  1. GetHistoryStateChangeUrl(currentURL, GURL(baseUrl), pageUrl) (:147). This works out the URL the page claims to be moving to.
  2. base_url.Resolve(pageUrl) returns pageUrl because it is absolute.
  3. IsHistoryStateChangeValid (G1) passes, because both sides are blob URLs and both come out empty.
  4. URLEscapedForHistory runs, escaping the URL for storage in history.
  5. replaceURL.is_valid() is checked, and blob:https://... is a valid URL, so this passes.
  6. G2 passes, for the same empty-equals-empty reason.
  7. replaceStateWithPageURL (:222) is called.
  8. NavigationManagerImpl::UpdateCurrentItemForReplaceState runs.
  9. navigation_manager_impl.mm:628-635 calls SetURL(url) on the current item, writing the attacker's URL into the browser's record of the current page.

Finally, NavigationItemImpl::GetVirtualURL() (navigation_item_impl.mm:178-180) returns url_ when virtual_url_ is empty. It is empty, because SetURL does not touch it. So the address bar is fed the attacker's URL.

Why does this matter? Because each of these steps is a gate the message has to pass. The report is showing that every gate is either passed legitimately or defeated by the empty-equals-empty comparison.

Step 5: the address bar rewrites the blob URL

The iOS steady-state location bar (components/omnibox/browser/location_bar_model_impl.cc:123-133, IS_IOS-only) rewrites the resulting blob: VirtualURL through url::Origin::Create(). That function parses the inner URL (url/origin.cc:46-51), so it extracts https://accounts.google.com. It then formats the result with kFormatUrlOmitHTTPS | kFormatUrlTrimAfterHost, which drops the https and trims everything after the host. The address bar displays the bare attacker-chosen hostname over attacker-controlled document content.

"Steady-state" means the address bar once the page has finished loading, as opposed to the transient state while a navigation is in progress.

What was observed

The steady-state address bar displays accounts.google.com (bare hostname, no blob: prefix) while the tab's content is the attacker-controlled document. The on-page diagnostic log confirms the real location.href is blob:http://<host-ip>:8080/<uuid> and location.origin is the attacker's origin.

In other words, the address bar and the page disagree, and the address bar is the one that lies.

Root cause

Location What it does
url/gurl.cc:255-259 DeprecatedGetOriginAsURL(): if (!is_valid_ || !IsStandard()) return GURL();, and blob is non-standard
ios/web/history_state_util.cc:19-20 Same-origin predicate uses DGOAU() equality
ios/web/navigation/navigation_java_script_feature.mm:33 kPageContentWorld, so the handler sits in the page world
ios/web/public/js_messaging/resources/gcrweb.ts:166-168 window.__gCrWeb is in the page world, so frame_id is readable
ios/web/navigation/navigation_manager_impl.mm:1403-1417 Reconciliation predicate uses DGOAU() equality
components/omnibox/browser/location_bar_model_impl.cc:123-133 IS_IOS: blob goes to url::Origin::Create, and the inner origin is displayed

Guards that were examined and did not help

  • crw_web_view_navigation_observer.mm:400-411 has an originAsURL.is_empty() early-reject, but that is the WKWebView.URL KVO path. KVO (key-value observing) is Apple's mechanism for being notified when a property changes. Direct handler invocation does not change WKWebView.URL, so KVO never fires.
  • CanTrustLastCommittedItem at :1404-1408 and :1421-1425 early-returns true for about:, file: and app-specific schemes. blob: is not listed, so it falls through to the empty-equals-empty comparison.
  • crw_js_navigation_handler.mm:139 DCHECK(changingHistoryState) is DCHECK-only. A DCHECK is an assertion that only exists in debug builds, so it does nothing in the shipping app; and it can be satisfied anyway by sending a preceding willChangeState message.
  • :151 !replaceURL.is_valid(): blob:https://... is valid, so this check does not reject it.
  • :159-162 GetItemCount() <= 1 && navItem->GetURL().is_empty(): the blob document's navItem URL is the (non-empty) blob URL, so this does not reject it either.

Impact

The attack is reachable from arbitrary web content with a stock renderer, no non-default flags and no user gesture. Any web page can cause the Chrome-on-iOS steady-state address bar to display an arbitrary attacker-chosen hostname over attacker-controlled document content. That is the classic address-bar spoof used for phishing.

The impact is bounded. It is iOS only: desktop and Android use a different navigation architecture with no WKScriptMessageHandler path, and the location_bar_model_impl.cc blob-strip is IS_IOS-gated. The displayed URL retains no attacker-visible artifact once steady-state formatting applies. document.location and document.origin inside the page still reflect the attacker's real blob origin, so same-origin DOM access to the spoofed origin is not gained. This is a display spoof, not a SOP bypass.

Fix

Any of the following would close it:

  • IsHistoryStateChangeValid compares via url::Origin::Create(url) (which correctly extracts the inner origin for blob:) instead of DeprecatedGetOriginAsURL().
  • The NavigationEventMessage handler moves to ContentWorld::kIsolatedWorld, or the didPushState and didReplaceState messages carry an isolated-world-only nonce, so page JavaScript cannot forge them. A nonce is a one-time random value that the page cannot guess.
  • CanTrustLastCommittedItem treats an empty DGOAU() on either side as untrusted, as the KVO path at crw_web_view_navigation_observer.mm:407-411 already does.

The suggested fix is to replace DeprecatedGetOriginAsURL() with url::Origin::Create() in IsHistoryStateChangeValid and CanTrustLastCommittedItem (and the KVO-path helper for consistency). url::Origin::Create handles blob: and filesystem: inner-URL extraction and opaque-origin nonce comparison correctly. Six call-sites in //ios/web use DGOAU() as a same-origin predicate on navigable URLs; all are candidates for the same replacement.

Independently, NavigationJavaScriptFeature in kPageContentWorld with a page-readable frame_id means page JavaScript can forge any of its messages (hashchange, didPushState, didReplaceState). Moving to isolated world, as several other //ios/web features already are, closes the direct-invocation path regardless of the origin-comparison fix.

Related in-tree notes: DeprecatedGetOriginAsURL() is documented-deprecated (url/gurl.h) with a migration TODO, and the //ios/web navigation path is distinguished from most other callers by having both comparison operands be page-navigable URLs with no is_valid() or SchemeIsHTTPOrHTTPS() pre-gate. crbug.com/40624624 is an in-tree TODO to move pushState and replaceState logic into NavigationManager, and crbug.com/41354482 is an in-tree TODO on the navigation.ts History.prototype interception, noting the interception exists for DidStartLoading compatibility.

  1. Other non-standard schemes in the same predicate. Try filesystem: and other schemes absent from url/url_util.cc:50-64 wherever DGOAU() is used as a same-origin check. A positive result is two different inner origins comparing equal, or an empty origin being accepted as trusted.
  2. Other page-world message handlers. Look for NavigationJavaScriptFeature-style features registered in kPageContentWorld with OriginFilter::kPublic and a page-readable frame_id. A positive result is a forged message from page JavaScript that changes native state.
  3. Timing on the frame_id gate. Post at document-parse time and again after calling registerFrame(), with retries. A positive result is the message being accepted on a delayed attempt after being dropped on the first.
  4. KVO versus direct invocation. Check whether a candidate path relies on WKWebView.URL KVO for its guard. A positive result is a state change that never touches WKWebView.URL, so the KVO early-reject never runs.
  5. CanTrustLastCommittedItem early-returns. Test schemes in the about:, file: and app-specific allowlist and schemes outside it. A positive result is a scheme that falls through to the empty-equals-empty comparison and returns true.

Glossary

  • Address bar / location bar / omnibox: the strip at the top of the browser window that shows the current page's address and accepts typed searches and URLs.
  • API: a defined set of functions one piece of software offers to another so they can talk to each other.
  • Blob URL: an address of the form blob:<origin>/<id> that points to content created in memory by a page, without a server.
  • Content world: an isolated JavaScript environment inside a web page. The page world is the one the page's own scripts run in; an isolated world is a separate one the page cannot reach.
  • Cookie / token / nonce: small values used to identify or authenticate something. A nonce is a one-time random value that cannot be guessed, used to prove a message came from a trusted source.
  • DCHECK: a debug-only assertion in Chrome's C++ code; it does nothing in a release build.
  • DGOAU: shorthand for DeprecatedGetOriginAsURL().
  • DOM: the in-memory tree of elements that makes up a web page, which scripts can read and change.
  • Frame / main frame: one document inside the browser window. The main frame is the top-level document; other frames are nested inside it.
  • frame_id: a number the browser uses to check that a message came from the frame it claims to come from.
  • GURL: Chrome's internal C++ type for a URL.
  • History state / pushState / replaceState: JavaScript functions that let a page change the URL shown for the current history entry without loading a new document.
  • Hostname: the part of a URL that names the site, such as accounts.google.com.
  • KVO (key-value observing): Apple's mechanism for being notified when a property of an object changes.
  • Navigation item: the browser's record of one entry in a tab's history, including its URL.
  • Navigation stack: the code that tracks where the browser is, which page is loaded, and what the address bar should show.
  • Origin: the security boundary of the web, made of scheme, host and port. Pages with the same origin may read each other's data; pages with different origins may not.
  • Phishing: tricking someone into believing they are on a trusted site so they hand over information such as passwords.
  • PoC (proof of concept): a small program that demonstrates a vulnerability really works.
  • Renderer: the part of the browser that draws and runs web pages.
  • Scheme: the part of a URL before the colon, such as https, http, file, about, blob or filesystem.
  • SOP (same-origin policy): the browser rule that stops pages from different origins reading each other's data.
  • Spoof: making something appear to be something it is not, here making the address bar show a hostname the page does not own.
  • Steady-state: the address bar once a page has finished loading, as opposed to while a navigation is in progress.
  • UI misrepresentation: a vulnerability class where the browser's interface shows something untrue about the page, such as a wrong address.
  • WKWebView: Apple's component for displaying web content inside an app on iOS.
  • WKScriptMessageHandler: Apple's channel that lets JavaScript inside a page send messages to the app's native code.
  • window.__gCrWeb: a JavaScript object Chrome attaches to the page's window so its injected scripts can talk to the browser.

More by NH DEV

View all

4 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.