Skip to content

tarteaucitron.js vulnerable to DOM Clobbering via document.currentScript

Moderate severity GitHub Reviewed Published Jul 3, 2025 in AmauriC/tarteaucitron.js • Updated Jul 3, 2025

Package

npm tarteaucitronjs (npm)

Affected versions

< 1.22.0

Patched versions

1.22.0

Description

A vulnerability was identified in tarteaucitron.js where document.currentScript was accessed without verifying that it referenced an actual <script> element. If an attacker injected an HTML element such as:

<img name="currentScript" src="https://malicious.example.com">

it could clobber the document.currentScript property. This causes the script to resolve incorrectly to an element instead of the <script> tag, leading to unexpected behavior or failure to load the script path correctly.

This issue arises because in some browser environments, named DOM elements (e.g., name="currentScript") become properties on the global document object.

Impact

An attacker with control over the HTML could exploit this to change the CDN domain of tarteaucitron.

Fix AmauriC/tarteaucitron.js@230a3b6

The issue was resolved by verifying that document.currentScript is an instance of HTMLScriptElement. If not, the script now falls back safely to the last <script> tag on the page.

References

@AmauriC AmauriC published to AmauriC/tarteaucitron.js Jul 3, 2025
Published to the GitHub Advisory Database Jul 3, 2025
Reviewed Jul 3, 2025
Published by the National Vulnerability Database Jul 3, 2025
Last updated Jul 3, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
High
User interaction
Required
Scope
Changed
Confidentiality
None
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:C/C:N/I:L/A:L

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(1st percentile)

Weaknesses

Improper Neutralization of Special Elements

The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as control elements or syntactic markers when they are sent to a downstream component. Learn more on MITRE.

CVE ID

CVE-2025-48939

GHSA ID

GHSA-q43x-79jr-cq98

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.