Skip to content
XSS Advisory Advanced CVE-2024-8907

Insufficient data validation in Omnibox (CVE-2024-8907)

Search terms saved in Chrome's Recent Search on Android were shown in the address bar and tab title instead of the full URL, and a saved term beginning with a javascript scheme was executed when the victim reopened it. This let an attacker spoof the address bar and run script in the context of any site the victim was visiting.

Muhammad Zaid Ghifari Follow

Originally disclosed on Chrome VRP

Bounty$1,000 Medium View original
  • Fix shipped in 31 days

Security Bug

Important: Please do not change the component of this bug manually.

Please READ THIS FAQ before filing a bug: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/security/faq.md

Please see the following link for instructions on filing security bugs: https://www.chromium.org/Home/chromium-security/reporting-security-bugs

Reports may be eligible for reward payments under the Chrome VRP: https://g.co/chrome/vrp

NOTE: Security bugs are normally made public once a fix has been widely deployed.


VULNERABILITY DETAILS

SOP Bypass leads to Address Bar Spoofing chained to Universal XSS found in the Address bar in Recent Search via search terms (keywords),

This results in all domains opened by the victim being able to trigger XSS, including sites that are used as payload to inject search terms (keywords) which produce Recent Searches, namely Search Engine and other sites that provide search terms (keywords) as titles.

the reason is that search keywords are also displayed in the tab title, likewise if the user only enters a search term, then selecting Recent Search will only display this search term, instead of displaying the full URL

Supposedly Javascript should not be executed when the browser checks the schema and cancels it, aka the Browser should not navigate to it directly but do a search for the term, which is shown in the video I attached in the PoC

VERSION

Chrome Version: [127.0.6533.103] + [stable] Operating System: [Android , 13, TECNO KJ6 Build/TP1A.220624.014]

REPRODUCTION CASE

Address Bar Spoofing :

  • Send Url to Victim
https://www.google.com/search?q=evil.com
https://www.google.com/search?q=https://evil.com

Notes : When the victim opens the URL above, this search term is saved in Recent Search on the victim's browser. when the victim is in the domain , example: facebook.com

  • the victim opens a Recent Search sent by the attacker previously
  • The victim was successfully spoofed to the attacker's site/malicious site

Universal XSS

  • Send this Url to Victim
https://www.google.com/search?q=javascript%3Aalert%28document.domain%29
https://www.google.com/search?q=javascript%3Aalert%28document.cookie%29

Notes : When the victim opens the URL above, this search term is saved in Recent Search on the victim's browser. when the victim is in the domain, example: youtube.com

  • the victim opens a Recent Search sent by the attacker previously
  • XSS is triggered in any domain the victim opens, Example: youtube.com

Expected results:

URLs with javascript schema: should not be executed.

Browsers should not be allowed to return search terms in the address bar via Recent Search from https -> javascript.

Please note, at this time apart from the location header, I have not tested whether this pattern can be used to load resources in a way that bypasses the SOP. Let me know if you have that information after reproducing this, I'd really like to learn it

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION Type of crash: [tab, browser, etc.] Crash State: [see link above: stack trace with symbols, registers, exception record] Client ID (if relevant): [see link above]

Reporter credit: Muhammad Zaid Ghifari

The original report as published on the Chromium issue tracker, by Muhammad Zaid Ghifari. 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. 6 min read.

Context

Chrome's Omnibox is the combined address and search bar. When a user types a term rather than a full URL, Chrome sends it to the configured search engine and, over time, keeps a history of those searches so they can be offered again as Recent Searches. Selecting a Recent Search normally re-runs the search or navigates to the stored destination.

This report describes two behaviours in that flow on Android: an address bar spoofing issue, and a Universal XSS reached by chaining the spoofing primitive with a javascript: search term. The researcher frames the underlying weakness as insufficient data validation in the Omnibox, and presents both issues together.

Setup

The testing was done on a single mobile device with a stable Chrome build:

Item Value
Chrome version 127.0.6533.103 (stable)
Operating system Android 13, TECNO KJ6 Build/TP1A.220624.014
Component Omnibox / Recent Search

No accounts, roles or special tooling are described. The precondition for both issues is that the victim has previously opened a crafted search URL, so that the search term is stored in Recent Search on the victim's browser. The attacker then needs the victim to pick that entry from Recent Search while browsing some other site.

Finding it

The researcher noticed that search keywords are also displayed in the tab title. As a consequence, when a user has only entered a search term, selecting that entry from Recent Search shows just the search term rather than the full URL. That mismatch between what the address bar shows and where the browser actually goes is the basis of the spoofing issue.

The second observation concerns scheme handling. The researcher's expectation is that JavaScript should not be executed when the browser checks the scheme and cancels it: the browser should not navigate to a javascript: value directly but should instead perform a search for the term. The report refers to an attached PoC video showing this behaviour, but no media is available here.

Exploitation

Step 1: Seed Recent Search with a spoofed destination

The attacker sends the victim one of the following URLs:

Text
https://www.google.com/search?q=evil.com
https://www.google.com/search?q=https://evil.com

When the victim opens either URL, the search term is saved in Recent Search on the victim's browser. The term itself is a domain.

Step 2: Trigger the spoof from another site

With the entry now stored, the victim browses to an unrelated domain, for example facebook.com. From there the victim opens the Recent Search entry that the attacker had caused to be saved. Because the entry displays the search term rather than the full URL, the victim is successfully spoofed to the attacker's site or a malicious site.

Step 3: Seed Recent Search with a javascript: term

The attacker sends one of these URLs:

Text
https://www.google.com/search?q=javascript%3Aalert%28document.domain%29
https://www.google.com/search?q=javascript%3Aalert%28document.cookie%29

The query value is a percent-encoded javascript: URI. As in step 1, opening the URL stores the search term in Recent Search on the victim's browser.

Step 4: Trigger the XSS from another site

The victim is on some domain, for example youtube.com, and opens the Recent Search entry the attacker previously caused to be saved. The XSS is then triggered in whatever domain the victim has open, with youtube.com given as the example. Because the payload runs in the context of the current site, the researcher describes the result as Universal XSS: all domains the victim opens can be affected, including sites that are used as the payload to inject search terms which produce Recent Searches, namely the search engine and other sites that provide search terms as titles.

The two payloads demonstrate the reach of the execution: document.domain and document.cookie are read in the context of the page the victim is on when the Recent Search entry is selected.

Expected results

The researcher states two expectations:

  1. URLs with a javascript: scheme should not be executed.
  2. Browsers should not be allowed to return search terms in the address bar via Recent Search when moving from https to javascript.

Scope note from the researcher

At the time of reporting, the researcher notes that apart from the location header, they had not tested whether this pattern can be used to load resources in a way that bypasses the SOP, and asks to be told if that is possible after reproduction.

Root cause

The report attributes the behaviour to insufficient data validation in the Omnibox. Two design decisions combine:

  • Search keywords are displayed in the tab title, and a Recent Search entry for a bare search term displays that term instead of the full URL. The address bar therefore reflects attacker-controlled text rather than the actual destination, which gives the spoofing primitive.
  • The researcher's expectation is that the browser should check the scheme and cancel it, performing a search instead of navigating to the javascript: value.

The researcher's stated expectation is that the browser should check the scheme and cancel it, performing a search for the term instead of navigating to it directly. The report does not describe the specific code path or the check that failed; the mechanism above is what the described behaviour implies.

Impact

An attacker who can get a victim to open a crafted search URL can plant an entry in Recent Search. If the victim later selects that entry while on another site, two outcomes are possible depending on the planted term:

  • Address bar spoofing: the victim is spoofed to the attacker's site or a malicious site.
  • Universal XSS: a javascript: term executes in the origin of whatever site the victim has open at the time, with payloads that alert document.domain and document.cookie in that context. The researcher describes this as affecting all domains the victim opens, including the search engine and other sites that supply search terms as titles.

Both outcomes require the victim to open the attacker-supplied URL first and then select the stored Recent Search entry. The report does not establish whether the pattern can be used beyond the location header to load resources in a way that bypasses the SOP.

Fix

The report does not describe a fix or a code change. The behaviour the researcher asks for is that javascript: URLs are not executed and that Recent Search does not carry a search term from https into a javascript: navigation in the address bar.

Variants to test

  • Other schemes in Recent Search. Plant terms using schemes other than javascript:, such as data: or vbscript:, and select them from Recent Search while on a third-party site. A positive result is execution or navigation in the current page's context rather than a search.
  • Other search entry points. Repeat the seeding step through any surface that stores a query as a Recent Search entry, not only the search engine URL used here. A positive result is the same stored term appearing as a selectable Recent Search entry.
  • Other display surfaces. Check whether the stored term is reflected in the tab title or other chrome UI beyond the address bar. A positive result is attacker-controlled text shown where the user expects the real destination.
  • Resource loading beyond the location header. The researcher explicitly left this untested. Try to use the stored term to load a resource rather than navigate, and observe whether the SOP is bypassed. A positive result is a cross-origin read or inclusion that would normally be blocked.

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. 11 min read.

What happened, in plain words

Chrome's address bar, called the Omnibox, is both an address bar and a search box. You can type a full web address into it, or you can type ordinary words and Chrome will send them to your chosen search engine. Over time Chrome remembers the things you searched for and offers them back to you as "Recent Searches", so you can repeat a search with one tap.

This report describes two problems in that flow on Android. The first is address bar spoofing: the address bar shows one thing while the browser actually goes somewhere else. The second is Universal XSS, a kind of script injection that can run in whatever website you happen to have open. Both problems are reported together. The researcher describes the underlying weakness as insufficient data validation in the Omnibox: the browser does not check carefully enough what is being stored and later reused.

To understand the report you only need a few ideas, explained as we go. A URL is a web address, like https://www.google.com/search?q=cats. The part after the ? is the query string, and q=cats means "the search term is cats". A scheme is the first word of a URL before the colon: https means an encrypted web page, and javascript is a special scheme that tells the browser to run the text that follows as a program. JavaScript is the programming language that web pages use to be interactive. XSS, short for Cross-Site Scripting, means getting someone else's JavaScript to run inside a page it does not belong to. SOP, the Same-Origin Policy, is the browser rule that stops one website from reading another website's data; an SOP bypass means getting around that rule.

Setup

The testing was done on one mobile device running a stable build of Chrome:

Item Value
Chrome version 127.0.6533.103 (stable)
Operating system Android 13, TECNO KJ6 Build/TP1A.220624.014
Component Omnibox / Recent Search

"Stable" means the ordinary public release, not a test or developer build. No accounts, special roles or extra tools are described. For both problems the same precondition applies: the victim must first have opened a crafted search URL, so that the search term gets stored in Recent Search on the victim's own browser. After that, the attacker needs the victim to pick that stored entry from Recent Search while browsing some other site.

Finding it

The researcher noticed that search keywords are also displayed in the tab title. The tab title is the text shown on the browser tab, at the top of the window. Because of this, when a user has only entered a search term, selecting that entry from Recent Search shows just the search term rather than the full URL. That mismatch, between what the address bar shows and where the browser actually goes, is the basis of the spoofing issue. A simple comparison: a taxi sign on the roof says "Airport" but the driver takes you somewhere else; you trusted the sign, not the route.

The second observation concerns scheme handling. The researcher's expectation is that JavaScript should not be executed when the browser checks the scheme and cancels it: the browser should not navigate to a javascript: value directly, but should instead perform a search for the term. The report refers to an attached proof-of-concept video showing this behaviour; no media is available here.

Exploitation

Step 1: Seed Recent Search with a spoofed destination

The attacker sends the victim one of the following URLs:

Text
https://www.google.com/search?q=evil.com
https://www.google.com/search?q=https://evil.com

Line by line:

  1. https://www.google.com/search?q=evil.com is an ordinary Google search URL. https is the encrypted web scheme, www.google.com is the site, /search is the search page, and q=evil.com sets the search term to the text evil.com.
  2. https://www.google.com/search?q=https://evil.com is the same thing, except the search term is itself a full-looking web address, https://evil.com.

Why this step: when the victim opens either URL, the search term is saved in Recent Search on the victim's browser. The term itself looks like a domain.

Step 2: Trigger the spoof from another site

With the entry now stored, the victim browses to an unrelated domain, for example facebook.com. From there the victim opens the Recent Search entry that the attacker had caused to be saved. Because the entry displays the search term rather than the full URL, the victim is successfully spoofed to the attacker's site or a malicious site.

Why this matters: the victim trusts the address bar to tell them where they are. The victim is spoofed to the attacker's site or a malicious site.

Step 3: Seed Recent Search with a javascript: term

The attacker sends one of these URLs:

Text
https://www.google.com/search?q=javascript%3Aalert%28document.domain%29
https://www.google.com/search?q=javascript%3Aalert%28document.cookie%29

Line by line:

  1. https://www.google.com/search?q=javascript%3Aalert%28document.domain%29 is a Google search URL whose search term is a percent-encoded piece of JavaScript. Percent-encoding is how special characters are written safely inside a URL: %3A is a colon :, %28 is (, and %29 is ). Decoded, the term reads javascript:alert(document.domain).
  2. https://www.google.com/search?q=javascript%3Aalert%28document.cookie%29 decodes to javascript:alert(document.cookie).

What the decoded payload does: javascript: tells the browser "run what follows as a program". alert(...) pops up a dialog box showing a value. document.domain is the current site's domain name, and document.cookie is the small pieces of data a site has stored in your browser for that site. A cookie is a short text value a website asks the browser to keep and send back on later visits, often used to remember that you are logged in. Showing it in an alert is a harmless way to prove that script can read it.

As in step 1, opening the URL stores the search term in Recent Search on the victim's browser. The attacker is now planting a small program, disguised as a search term, in the victim's history.

Step 4: Trigger the XSS from another site

The victim is on some domain, for example youtube.com, and opens the Recent Search entry the attacker previously caused to be saved. The XSS is then triggered in whatever domain the victim has open, with youtube.com given as the example. Because the payload runs in the context of the current site, the researcher describes the result as Universal XSS: all domains the victim opens can be affected, including sites that are used as the payload to inject search terms which produce Recent Searches, namely the search engine and other sites that provide search terms as titles.

"In the context of the current site" is the key phrase. Normally, script from one site cannot read another site's cookies or page contents; that is what the Same-Origin Policy prevents. Here the script is treated as belonging to whatever page is open, so it can read that page's document.domain and document.cookie. The two payloads demonstrate the reach of the execution: document.domain and document.cookie are read in the context of the page the victim is on when the Recent Search entry is selected.

Expected results

The researcher states two expectations:

  1. URLs with a javascript: scheme should not be executed.
  2. Browsers should not be allowed to return search terms in the address bar via Recent Search when moving from https to javascript.

In other words, a stored search term should always be treated as text to search for, never as a command to run, and the address bar should not display attacker-chosen text as if it were the real destination.

Scope note from the researcher

At the time of reporting, the researcher notes that apart from the location header, they had not tested whether this pattern can be used to load resources in a way that bypasses the SOP, and asks to be told if that is possible after reproduction. The location header is a line in a web server's reply that tells the browser to go to a different address. The researcher is saying: I have shown navigation and script execution, but I have not checked whether this trick can also fetch data across sites.

Root cause

The report attributes the behaviour to insufficient data validation in the Omnibox. Two design decisions combine:

  • Search keywords are displayed in the tab title, and a Recent Search entry for a bare search term displays that term instead of the full URL. The address bar therefore reflects attacker-controlled text rather than the actual destination, which gives the spoofing primitive. A primitive here means a small building block that can be used to build a bigger attack.
  • The researcher's expectation is that the browser should check the scheme and cancel it, performing a search instead of navigating to the javascript: value. An origin is the combination of scheme, host and port that the browser uses to decide what counts as "the same site".

The researcher's stated expectation is that the browser should check the scheme and cancel it, performing a search for the term instead of navigating to it directly. The report does not describe the specific code path or the check that failed; the mechanism above is what the described behaviour implies.

Impact

An attacker who can get a victim to open a crafted search URL can plant an entry in Recent Search. If the victim later selects that entry while on another site, two outcomes are possible depending on the planted term:

  • Address bar spoofing: the victim is spoofed to the attacker's site or a malicious site.
  • Universal XSS: a javascript: term executes in the origin of whatever site the victim has open at the time, with payloads that alert document.domain and document.cookie in that context. The researcher describes this as affecting all domains the victim opens, including the search engine and other sites that supply search terms as titles.

Both outcomes require the victim to open the attacker-supplied URL first and then select the stored Recent Search entry. The report does not establish whether the pattern can be used beyond the location header to load resources in a way that bypasses the SOP.

Fix

The report does not describe a fix or a code change. The behaviour the researcher asks for is that javascript: URLs are not executed and that Recent Search does not carry a search term from https into a javascript navigation in the address bar.

Variants to test

These are follow-up ideas, not things the report says were tested:

  • Other schemes in Recent Search. Plant terms using schemes other than javascript:, such as data: or vbscript:, and select them from Recent Search while on a third-party site. A positive result is execution or navigation in the current page's context rather than a search. A scheme is the first part of a URL before the colon; data: embeds content directly in the address, and vbscript: is an older scripting scheme.
  • Other search entry points. Repeat the seeding step through any surface that stores a query as a Recent Search entry, not only the search engine URL used here. A positive result is the same stored term appearing as a selectable Recent Search entry.
  • Other display surfaces. Check whether the stored term is reflected in the tab title or other browser interface beyond the address bar. A positive result is attacker-controlled text shown where the user expects the real destination.
  • Resource loading beyond the location header. The researcher explicitly left this untested. Try to use the stored term to load a resource rather than navigate, and observe whether the SOP is bypassed. A positive result is a cross-origin read or inclusion that would normally be blocked.

Glossary

  • Omnibox: Chrome's combined address and search bar.
  • Recent Search: a list of past search terms Chrome offers so you can repeat a search quickly.
  • URL: a web address, such as https://www.google.com/search?q=cats.
  • Query string: the part of a URL after ?, carrying values such as a search term.
  • Scheme: the first word of a URL before the colon, such as https or javascript.
  • JavaScript: the programming language web pages use to be interactive.
  • XSS (Cross-Site Scripting): getting someone else's JavaScript to run inside a page it does not belong to.
  • Universal XSS: XSS that can run in whatever site the victim currently has open.
  • SOP (Same-Origin Policy): the browser rule that stops one website from reading another website's data.
  • SOP bypass: getting around the Same-Origin Policy.
  • Origin: the combination of scheme, host and port that decides what counts as the same site.
  • Address bar spoofing: showing a misleading address in the address bar while the browser is actually somewhere else.
  • Phishing: a fake page or message that pretends to be a real one to trick you into giving something away.
  • Percent-encoding: writing special characters in a URL as % plus a code, such as %3A for a colon.
  • Cookie: a short text value a website asks the browser to keep and send back on later visits, often used to remember that you are logged in.
  • document.domain: a JavaScript value holding the current page's domain name.
  • document.cookie: a JavaScript value holding the cookies for the current page.
  • alert(...): a JavaScript function that pops up a dialog box showing a value.
  • Location header: a line in a web server's reply telling the browser to go to a different address.
  • Primitive: a small building block that can be used to build a bigger attack.
  • Stable: the ordinary public release of a browser, not a test or developer build.
  • Proof of concept (PoC): a demonstration that a problem is real, often a video or short script.

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.