Resource Exhaustion Affecting py3-sqlparse package, versions <0.4.2-r0


Severity

Recommended
0.0
high
0
10

Snyk's Security Team recommends NVD's CVSS assessment. Learn more

Threat Intelligence

EPSS
2.34% (83rd 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 IDSNYK-ALPINE315-PY3SQLPARSE-1929289
  • published23 Oct 2021
  • disclosed20 Sept 2021

Introduced: 20 Sep 2021

CVE-2021-32839  (opens in a new tab)
CWE-400  (opens in a new tab)

How to fix?

Upgrade Alpine:3.15 py3-sqlparse to version 0.4.2-r0 or higher.

NVD Description

Note: Versions mentioned in the description apply only to the upstream py3-sqlparse package and not the py3-sqlparse package as distributed by Alpine. See How to fix? for Alpine:3.15 relevant fixed versions and status.

sqlparse is a non-validating SQL parser module for Python. In sqlparse versions 0.4.0 and 0.4.1 there is a regular Expression Denial of Service in sqlparse vulnerability. The regular expression may cause exponential backtracking on strings containing many repetitions of '\r\n' in SQL comments. Only the formatting feature that removes comments from SQL statements is affected by this regular expression. As a workaround don't use the sqlformat.format function with keyword strip_comments=True or the --strip-comments command line flag when using the sqlformat command line tool. The issues has been fixed in sqlparse 0.4.2.

CVSS Base Scores

version 3.1