Skip to content
XSS Advisory Advanced CVE-2024-10229

Inappropriate implementation in Extensions (CVE-2024-10229)

The import function in Chromium extensions is not properly isolated, so a content script's dynamic import goes through the website's service worker. An attacker can create a malicious website that replaces the imported script and reads the extension's chrome.[redacted] data, potentially stealing authentication tokens.

Vsevolod Kokorin Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 28 days

Steps to reproduce the problem

  1. Create folder with extension
  2. Copy background.js, content.js, logo.jpg and manifest.json to the extension folder
  3. Create assets folder into extension folder and copy example.js there.
  4. Extension folder structure should look like at extension_directory.jpg
  5. Go to chrome://extensions/ and upload your extension via "Load unpacked"
  6. Click on extension icon to trigger chrome.storage.local.set
  7. Upload "index.html" and "service-worker.js" on https host
  8. Go to this host
  9. You will see extension storage at page content

Problem Description

In Chromium, the isolation for the import function is implemented incorrectly. An import call from an isolated extension context (content script) goes through site service worker, allowing the script to be replaced in many popular extensions. This enables an attacker to create a website with an exploit and gain access to chrome.storage.local on behalf of the extension.

I have discovered numerous extensions affected by this issue, and they are very popular (1m+ downloads). This behavior is not described in the Chrome documentation and poses a risk to user data (in tested real-world extensions, it was possible to steal user authentication data stored by the extension, as many keep it in storage). In rare cases, it can also lead to UXSS (Universal Cross-Site Scripting) thanks to such extensions.

I believe this behavior is not intuitive and contradicts the logic of context isolation. Therefore, I recommend removing the ability for websites to intercept the import call from an isolated context or explicitly documenting the warning about the dangers of using dynamic module imports in extensions. A PoC is attached.

I am attaching a simple PoC, which consists of a basic extension that exposes chrome.storage.local (and does not use it in any other way).

I am also attaching an example of an attacker's website, which replaces a script dynamically loaded by the extension, allowing the extension's storage to be displayed on the page.

A real-world exploitation example could be more complex and might include sending the storage data to the attacker's website and interacting with chrome.runtime to achieve additional impact by calling the extension’s background.js with unfiltered data.

For your convenience, I am also attaching a "chrome.mov" demonstrating the steps described in the PoC.

Summary

Chrome Extension context isolation bypass.

Custom Questions

Reporter credit:

Vsevolod Kokorin (Slonser) of Solidlab

Additional Data

Category: Security
Chrome Channel: Stable
Regression: N/A

The original report as published on the Chromium issue tracker, by Vsevolod Kokorin (Slonser) of Solidlab. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 import() call from an isolated content script is resolved through the page's service worker instead of being isolated from the web context.

Impact

An attacker could steal user authentication data stored by the extension, and in rare cases achieve universal cross-site scripting (UXSS).

What the attacker needed

Victim installs a vulnerable extension; victim visits attacker's HTTPS site; extension uses dynamic import in content script

The fix

The ability for websites to intercept the import call from an isolated context should be removed, or the danger should be explicitly documented.

How it was found

  1. Create an extension folder with background.js, content.js, logo.jpg, manifest.json, and an assets folder containing example.js.
  2. Load the extension via chrome://extensions/ using 'Load unpacked'.
  3. Click the extension icon to trigger chrome.[redacted].set.
  4. Host an index.html and service-worker.js on an HTTPS server.
  5. Visit the attacker's HTTPS host.
  6. Observe the extension's storage displayed on the page.

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.

Browser extensions can store data like login tokens in a private storage area. Normally, a website cannot access that storage. This report shows that a website can trick the extension into loading a script from the website, and then replace that script to read the extension's storage.

What is XSS?

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

More by Vsevolod Kokorin

View all

3 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.