Vulnerabilities in pkg:npm/prismjs

PACKAGE
Advisory Identifier: GHSA-x7hr-w5r2-h6wg
Advisory Summary

CVE-2024-53382 is a MODERATE (CVSS 4.9) prismjs dom clobbering vulnerability vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Prismjs libraries in the npm ecosystem. The issue involves prismjs dom clobbering vulnerability. Remediation is available by upgrading affected packages to version 1.30.0.

6 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/prismjs

6 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/prismjs. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-x7hr-w5r2-h6wg CVE-2024-53382 MODERATE PrismJS DOM Clobbering vulnerability
GHSA-h4hr-7fg3-h35w CVE-2021-23341 HIGH Denial of service in prismjs
GHSA-hqhp-5p83-hx96 CVE-2021-3801 MODERATE prismjs Regular Expression Denial of Service vulnerability
GHSA-3949-f494-cm99 CVE-2022-23647 HIGH Cross-site Scripting in Prism
GHSA-gj77-59wh-66hg CVE-2021-32723 HIGH Regular Expression Denial of Service (ReDoS) in Prism
GHSA-wvhm-4hhf-97x9 CVE-2020-15138 HIGH Cross-Site Scripting in Prism

CVE-2024-53382 at a Glance

CVE Identifier CVE-2024-53382
GHSA Identifier GHSA-x7hr-w5r2-h6wg
Severity MODERATE
CVSS v3.1 Base Score 4.9
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Prismjs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-53382

To remediate this vulnerability, upgrade all affected Prismjs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

prismjs fixed: 1.30.0
npm install prismjs@1.30.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls prismjs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-53382, inspect your project dependencies using npm:

npm ls prismjs

Analyze the terminal output to locate any version of Prismjs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.30.0), your application is affected.

Note: The npm ls prismjs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Prismjs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2024-53382 Affected Prismjs Versions

1 component(s)
Fixed Versions:
1.30.0
Product / Package Ecosystem Affected Versions Fixed Version
prismjs
npm
< 1.30.0
1.30.0

References

Frequently Asked Questions

What is CVE-2024-53382?
CVE-2024-53382 is a security vulnerability in Prismjs involving PrismJS DOM Clobbering vulnerability under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Prismjs versions are affected?
Affected versions include releases prior to 1.30.0 across affected packages: prismjs.
What version fixes CVE-2024-53382?
Upgrading to 1.30.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is prismjs affected?
Yes, prismjs is affected in releases prior to 1.30.0. Upgrade your dependency to 1.30.0 or later.
What is the CVSS score of CVE-2024-53382?
CVE-2024-53382 has a CVSS v3.1 base score of 4.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2024-53382?
CVE-2024-53382 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2024-53382?
Run the dependency tree command: 'npm ls prismjs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-x7hr-w5r2-h6wg",
  "modified" : "2025-06-30T12:51:19Z",
  "published" : "2025-03-03T09:30:34Z",
  "aliases" : [ "CVE-2024-53382" ],
  "summary" : "PrismJS DOM Clobbering vulnerability",
  "details" : "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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "prismjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.30.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-53382"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrismJS/prism/pull/3863"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrismJS/prism/commit/8e8b9352dac64457194dd9e51096b4772532e53d"
  }, {
    "type" : "WEB",
    "url" : "https://gist.github.com/jackfromeast/aeb128e44f05f95828a1a824708df660"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/PrismJS/prism"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/prism.js#L226-L259"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-94" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-03T20:16:32Z",
    "nvd_published_at" : "2025-03-03T07:15:33Z"
  }
}