GHSA-p72q-h37j-3hq7 dbt uses a SQLparse version with a high vulnerability

Not scored Published

An attacker can cause a denial of service in dbt-core by triggering a recursion error in the bundled sqlparse library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Not stated
Victim action needed
Not needed
Fix
Available

What is GHSA-p72q-h37j-3hq7?

GHSA-p72q-h37j-3hq7 is a denial of service vulnerability in dbt-core, published on 22 Apr 2024.

Official description

Summary

Using a version of sqlparse that has a security vulnerability and no way to update in current version of dbt core. Snyk recommends using sqlparse==0.5 but this causes a conflict with dbt. Snyk states the issues is a recursion error: SNYK-PYTHON-SQLPARSE-6615674.

Details

Dependency conflict error message:

The conflict is caused by:
    The user requested sqlparse==0.5
    dbt-core 1.7.10 depends on sqlparse<0.5 and >=0.2.3

Resolution was to pin sqlparse >=0.5.0, <0.6.0 in dbt-core, patched in 1.6.13 and 1.7.13.

PoC

From Snyk:

import sqlparse
sqlparse.parse('[' * 10000 + ']' * 10000)

Impact

Snyk classifies it as high 7.5/10.

Patches

The bug has been fixed in dbt-core v1.6.13 and dbt-core v1.7.13.

Mitigations

Bump dbt-core 1.6 and 1.7 dependencies to 1.6.13 and 1.7.13 respectively

Which versions are affected by GHSA-p72q-h37j-3hq7?

4 open source packages ship an affected version, including dbt-core.

PackageAffectedFixed in
dbt-core PyPIFrom 1.6.01.6.13
dbt-core PyPIFrom 1.6.01.6.13
dbt-core PyPIFrom 1.7.01.7.13
dbt-core PyPIFrom 1.7.01.7.13

How do I fix GHSA-p72q-h37j-3hq7?

Upgrade dbt-core to a fixed version for your release line: 1.6.13 or 1.7.13.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is GHSA-p72q-h37j-3hq7 being exploited?

There is no known exploitation of GHSA-p72q-h37j-3hq7 in the wild and no public exploit code.

Sources

Is GHSA-p72q-h37j-3hq7 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free