Cross-site Scripting (XSS) Affecting markdown-it package, versions <4.1.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-site Scripting (XSS) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDnpm:markdown-it:20160912
  • published27 Sept 2016
  • disclosed31 Mar 2015
  • creditVitaly Puzrin

Introduced: 31 Mar 2015

CVE NOT AVAILABLE CWE-79  (opens in a new tab)

How to fix?

Upgrade to markdown-it version 4.1.0 or newer.

Overview

markdown-it is a pluggable markdown parser used for rendering markdown content to html.

Affected versions of the package allowed the use of data: URIs for all mime types by default potentially opening a door for Cross-site Scripting (XSS) attacks.

The fix was introduced in version 4.1.0, whitelisting the following four data types image/gif, image/png, image/jpeg and image/webp while blocking the others by default.

Data URIs enable embedding small files in line in HTML documents, provided in the URL itself. Attackers can craft malicious web pages containing either HTML or script code that utilizes the data URI scheme, allowing them to bypass access controls or steal sensitive information.

An example of data URI used to deliver javascript code. The data holds <script>alert('XSS')</script> tag in base64 encoded format.

[xss link](data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K)

Details

<>

CVSS Scores

version 3.1