prismjs@1.18.0 vulnerabilities

Lightweight, robust, elegant syntax highlighting. A spin-off project from Dabblet.

Direct Vulnerabilities

Known vulnerabilities in the prismjs package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • M
Cross-site Scripting (XSS)

prismjs is a lightweight, robust, elegant syntax highlighting library.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the command line plugin which does not properly escape its output, leading to the input text being inserted into the DOM as HTML code.

How to fix Cross-site Scripting (XSS)?

Upgrade prismjs to version 1.27.0 or higher.

>=1.14.0 <1.27.0
  • H
Regular Expression Denial of Service (ReDoS)

prismjs is a lightweight, robust, elegant syntax highlighting library.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the Prism.languages.markup.comment regex.

PoC

var comment = /<!--[\s\S]*?-->/
for(var i = 1; i <= 50000; i++) {
  var time = Date.now();
  var attack_str = ""+"<!--".repeat(i*10000)+"-"
  comment.test(attack_str)
  var time_taken = Date.now() - time;
  console.log("attack_str.length: " + attack_str.length + ": " + time_taken+" ms")
}

How to fix Regular Expression Denial of Service (ReDoS)?

Upgrade prismjs to version 1.25.0 or higher.

<1.25.0
  • H
Regular Expression Denial of Service (ReDoS)

prismjs is a lightweight, robust, elegant syntax highlighting library.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the prism-asciidoc and prism-erb components. When Prism is used to highlight untrusted (user-given) text, an attacker can craft a string that will take a very very long time to highlight.

How to fix Regular Expression Denial of Service (ReDoS)?

Upgrade prismjs to version 1.24.0 or higher.

<1.24.0
  • H
Regular Expression Denial of Service (ReDoS)

prismjs is a lightweight, robust, elegant syntax highlighting library.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the prism-asciidoc, prism-rest, prism-tap and prism-eiffel components.

How to fix Regular Expression Denial of Service (ReDoS)?

Upgrade prismjs to version 1.23.0 or higher.

<1.23.0
  • H
Cross-site Scripting (XSS)

prismjs is a lightweight, robust, elegant syntax highlighting library.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the easing preview of the Previewers plugin. It allows attackers to execute arbitrary code in Safari and Internet Explorer.

How to fix Cross-site Scripting (XSS)?

Upgrade prismjs to version 1.21.0 or higher.

>=1.1.0 <1.21.0