Skip to content
CORS Disclosed report Advanced CVE-2021-23986

Cross-origin read SOP violation by extension via search provider

A malicious browser extension could install a search provider whose favicon URL pointed at an arbitrary absolute web address, and the search engine manager would fetch that resource and hand its contents back to the extension as a data URI. This let the extension read cross-origin responses that the same-origin policy would normally block, though without the victim's cookies.

Armin Ebert Follow

Originally disclosed on Mozilla

  • Fixed in 10 days
  • Paid in 11 days
  • Disclosed after 10 days

A malicious extension can read cross-origin resources by installing a specially crafted search provider and using the browser.search API.

This happens as the search engine manager fetches any absolute favicon URL, and converts the content to a data: URI which is made available to extension code, regardless of the resource's actual content type (e.g. text/html).

Proof of concept

  • Create an extension which adds a search engine via the chrome_settings_overrides.search_provider manifest key. Set favicon_url to the web resource that should be read cross-origin. The target's content-type is irrelevant.
  • Use browser.search.get() to retrieve the installed search engine.
  • Base64-decode the engine's favIconUrl data: URI payload.

Analysis

The manifest format for the favicon URL, relativeUrl, permits absolute URLs. In parent/ext-search.js#34-41, only extension-relative icons are converted to data: URIs (engine.iconURI.schemeIs("moz-extension") && engine.iconURI.host !== context.extension.uuid). However, icon conversion is also done earlier in SearchEngine.jsm#766-813 without checking origin or content type. Hence, when ext-search.js queries the search service, the icons are already converted to data: URIs.

Security impact

The search permission does not show up in the addon details ("This extension doesn’t require any permissions.") or during installation, allowing an attack to go unnoticed. But while any http[s] URL can be targeted, cookies aren't transmitted. This makes the attack most useful against e.g. local interfaces/intranet resources, but doesn't allow an attacker to trivially tap the user's current web mail session.

The original report as published on Mozilla's Bugzilla, by Armin Ebert. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the search engine manager converted any absolute favicon URL into a data URI without checking the resource's origin or content type, so extension code received cross-origin content it should not have been able to read.

Impact

An attacker could read cross-origin resources such as local interfaces and intranet pages, but cookies are not sent, so the user's authenticated web sessions could not be trivially read.

What the attacker needed

Victim installs a malicious extension; target reachable without cookies

How it was found

  1. Create an extension that adds a search engine through the settings overrides manifest key and sets the favicon URL to the cross-origin resource to read.
  2. Use the search API to retrieve the installed search engine.
  3. Base64-decode the data URI payload in the engine's favicon URL to obtain the resource contents.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Websites normally cannot read data from other websites because of a rule called the same-origin policy, which keeps one site's pages from peeking at another's. A browser extension is supposed to follow similar limits, but here it could ask the browser to fetch a page as if it were a search engine icon and then read the result. The extension also hid this ability from the user, so nothing warned them during installation.

What is CORS?

A permissive cross-origin policy lets another site read responses with the user's credentials.

More by Armin Ebert

View all

18 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.