CVE-2024-53382
NoneCVSS
—
EPSS
0.3%
Published
Mar 3, 2025
CISA due date
—
Cloudanix analysis
A flaw in a widely-used code highlighting tool could allow an attacker to inject malicious code into a website, potentially leading to the theft of user information or account takeover.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Data Exposure
- Component
- Library
- Class
- XSS
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability allows for DOM Clobbering, where an attacker can inject specific HTML elements (e.g., `<img id="currentScript">`) to create global JavaScript variables that shadow legitimate browser objects. PrismJS, when looking for `document.currentScript`, can be tricked into referencing an attacker-controlled HTML element instead of its own script tag. This can lead to the library processing attributes from the malicious element, resulting in Cross-Site Scripting (XSS) without the need for traditional `<script>` tags in the payload.
Why it matters to the business
Exploitation of this vulnerability can lead to the compromise of user accounts and data. Attackers can steal session cookies to impersonate users, access sensitive information, perform unauthorized actions, or deface web pages. This can result in reputational damage, loss of customer trust, and potential regulatory fines if sensitive user data is breached.
How an attack unfolds
An attacker targets a web application using a vulnerable version of PrismJS that displays user-supplied content. The attacker submits a specially crafted HTML payload, for example in a comment field. This payload does not contain a `<script>` tag but includes an element like `<img id="currentScript" src="x" onerror="alert('XSS')">`. When a victim views the page, this element clobbers the `document.currentScript` property. When PrismJS initializes, it mistakenly reads this attacker-controlled element as its own script, processes its attributes, and triggers the `onerror` event, executing the attacker's arbitrary JavaScript in the victim's browser.
How to fix it
Upgrade PrismJS to a version later than 1.29.0. The recommended action is to update to the latest stable version available. If an immediate upgrade is not feasible, implement strict input sanitization on all user-provided content using a library that is aware of and mitigates DOM Clobbering attacks. Additionally, implement a strong Content Security Policy (CSP) to restrict the execution of inline scripts and control resource loading as a defense-in-depth measure.
How to confirm the fix worked
To confirm remediation, verify that all instances of the PrismJS library in your applications are updated to a version greater than 1.29.0. Check project dependency files (e.g., `package.json`, `yarn.lock`, `pom.xml`) and inspect the version numbers within the `prism.js` files themselves. To test for exposure, you can manually inject a payload like `<img id="currentScript">` into a relevant input field and use browser developer tools to inspect if the `document.currentScript` object is successfully overwritten by the injected element.
Typical attack path
- The attacker identifies a target website using PrismJS version 1.29.0 or earlier to render user-provided content.
- The attacker crafts an HTML payload containing an element with its `id` or `name` attribute set to `currentScript`.
- The payload is submitted to the website through a feature like a comment section, forum post, or user profile.
- A victim user navigates to the page containing the malicious payload.
- The browser renders the page, and the attacker's element overwrites the `document.currentScript` property in the DOM.
- PrismJS executes, reads the malicious element instead of its own script, and its logic triggers the execution of JavaScript embedded in the element's attributes (e.g., `onerror`).
- The attacker's script runs in the victim's browser, achieving XSS.
How to detect it
To detect potential exploitation, security teams should search web server access logs, WAF logs, and application database records for suspicious HTML payloads. Look for submissions containing HTML elements with `id` or `name` attributes set to `currentScript`. Specifically, search for patterns like `<img id="currentScript">`, `<form id="currentScript">`, or `<a name="currentScript">` within user-generated content fields. On the client-side, monitor for anomalous script executions originating from non-script elements on pages that utilize PrismJS.
- id="currentScript"
- name="currentScript"
What your security team should do
- Immediately identify all applications using PrismJS and prioritize upgrading those that are public-facing or handle user-generated content to a version later than 1.29.0.
- Perform a comprehensive code and dependency scan to locate all instances of the vulnerable library, including vendored copies.
- Review and enforce a strict Content Security Policy (CSP) to limit the impact of this and future XSS vulnerabilities.
- Ensure that a robust HTML sanitization library, configured to prevent DOM Clobbering, is used for all untrusted HTML content before it is rendered.
The record
Prism (aka PrismJS) through 1.29.0 allows DOM Clobbering (with resultant XSS for untrusted input that contains HTML but does not directly contain JavaScript), because document.currentScript lookup can be shadowed by attacker-injected HTML elements.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| npm | prismjs | 0 | 1.30.0 |
| Chainguard | kibana-7 | 0 | 7.17.29-r5 |
| Chainguard | kibana-8.19 | 0 | 8.19.3-r1 |
| Chainguard | kibana-8.19-bitnami | 0 | 8.19.3-r1 |
| Chainguard | kibana-8.19-iamguarded | 0 | 8.19.3-r1 |
| Chainguard | opensearch-dashboards-2 | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-alerting-dashboards-plugin | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-anomaly-detection-dashboards-plugin | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-config | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-dashboards-maps | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-dashboards-notifications | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-dashboards-observability | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-dashboards-query-workbench | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-dashboards-reporting | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-dashboards-search-relevance | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-dashboards-visualizations | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-fips | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-alerting-dashboards-plugin | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-anomaly-detection-dashboards-plugin | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-config | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-maps | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-notifications | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-observability | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-query-workbench | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-reporting | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-search-relevance | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-visualizations | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-fips-index-management-dashboards-plugin | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-ml-commons-dashboards | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-security-analytics-dashboards-plugin | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-fips-security-dashboards-plugin | 0 | 2.19.2-r4 |
| Chainguard | opensearch-dashboards-2-index-management-dashboards-plugin | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-ml-commons-dashboards | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-security-analytics-dashboards-plugin | 0 | 2.19.4-r0 |
| Chainguard | opensearch-dashboards-2-security-dashboards-plugin | 0 | 2.19.4-r0 |
| Debian:11 | node-prismjs | 0 | No fix |
| Debian:12 | node-prismjs | 0 | No fix |
| Debian:13 | node-prismjs | 0 | No fix |
| Debian:14 | node-prismjs | 0 | 1.30.0+dfsg+~1.26.5-1 |
| Wolfi | opensearch-dashboards-2 | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-alerting-dashboards-plugin | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-anomaly-detection-dashboards-plugin | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-config | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-dashboards-maps | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-dashboards-notifications | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-dashboards-observability | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-dashboards-query-workbench | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-dashboards-reporting | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-dashboards-search-relevance | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-dashboards-visualizations | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-index-management-dashboards-plugin | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-ml-commons-dashboards | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-security-analytics-dashboards-plugin | 0 | 2.19.4-r0 |
| Wolfi | opensearch-dashboards-2-security-dashboards-plugin | 0 | 2.19.4-r0 |
Related vulnerabilities
- CVE-2026-33895 Forge (also called `node-forge`) is a native implementation of Transport Layer Security… Also affects kibana-7
- CVE-2026-33896 Forge (also called `node-forge`) is a native implementation of Transport Layer Security… Also affects kibana-7
- CVE-2026-33894 Forge (also called `node-forge`) is a native implementation of Transport Layer Security… Also affects kibana-7
- CVE-2026-33891 Forge (also called `node-forge`) is a native implementation of Transport Layer Security… Also affects kibana-7
- CVE-2026-33750 The brace-expansion library generates arbitrary strings containing a common prefix and… Also affects kibana-7
- GHSA-2328-f5f3-gj25 Forge has a basicConstraints bypass in its certificate chain verification (RFC 5280… Also affects kibana-7
- GHSA-q67f-28xg-22rw Forge has signature forgery in Ed25519 due to missing S > L check Also affects kibana-7
- GHSA-ppp5-5v6c-4jwp Forge has signature forgery in RSA-PKCS due to ASN.1 extra field Also affects kibana-7