reportlab@3.0 vulnerabilities

The Reportlab Toolkit

Direct Vulnerabilities

Known vulnerabilities in the reportlab 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
  • H
Arbitrary Code Execution

reportlab is a Python library for generating PDFs and graphics.

Affected versions of this package are vulnerable to Arbitrary Code Execution via the paraparser.py function. An attacker can inject malicious input in a unichar element in a crafted XML document.

Note: This is only exploitable if the attacker uses a crafted malicious html 'unichar' tag input and then uses the feature to generate a pdf of the document.

How to fix Arbitrary Code Execution?

Upgrade reportlab to version 3.5.31 or higher.

[,3.5.31)
  • H
Remote Code Execution (RCE)

reportlab is a Python library for generating PDFs and graphics.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) due to insufficient checks in the ‘rl_safe_eval’ function. Attackers can inject malicious code into an HTML file that will later be converted to PDF using software that relies on the ReportLab library. To exploit the vulnerability, the entire malicious code must be executed with eval in a single expression.

Note:

This exploit is possible only if users allow hostile input to be passed into colors - for example if accepting the URL of an HTML page someone else had written, with a generic conversion routine.

How to fix Remote Code Execution (RCE)?

Upgrade reportlab to version 3.6.13 or higher.

[,3.6.13)
  • M
Server-side Request Forgery (SSRF)

reportlab is a Python library for generating PDFs and graphics.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via img tags. In order to reduce risk, use trustedSchemes & trustedHosts (see in Reportlab's documentation), introduced in version 3.5.55.

Steps to reproduce by Karan Bamal:

  1. Download and install the latest package of reportlab
  2. Go to demos -> odyssey -> dodyssey
  3. In the text file odyssey.txt that needs to be converted to pdf inject <img src="http://127.0.0.1:5000" valign="top"/>
  4. Create a nc listener nc -lp 5000
  5. Run python3 dodyssey.py
  6. You will get a hit on your nc showing we have successfully proceded to send a server side request
  7. dodyssey.py will show error since there is no img file on the url, but we are able to do SSRF

How to fix Server-side Request Forgery (SSRF)?

Upgrade reportlab to version 3.5.55 or higher.

[0,3.5.55)
  • H
Remote Code Execution (RCE)

reportlab is a Python library for generating PDFs and graphics.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) due to toColor(eval(arg)) in colors.py, as demonstrated by a crafted XML document with <span color=" followed by arbitrary Python code.

How to fix Remote Code Execution (RCE)?

Upgrade reportlab to version 3.5.34 or higher.

[0,3.5.34)