GHSA-p72q-h37j-3hq7: Dbt core Dbt Uses A SQLparse Version Vulnerability

HIGH
CVSS 7.5
CWE-673
Published
Advisory Summary

GHSA-p72q-h37j-3hq7 is a HIGH (CVSS 7.5) dbt uses a sqlparse version vulnerability (CWE-673: External Influence of Sphere Definition) affecting Dbt core libraries in the PyPI ecosystem. The issue involves dbt uses a sqlparse version with a high vulnerability. Remediation is available by upgrading affected packages to version 1.6.13, 1.7.13.

GHSA-p72q-h37j-3hq7 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-p72q-h37j-3hq7
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-673: External Influence of Sphere Definition
Affected Product Dbt core
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix GHSA-p72q-h37j-3hq7

To remediate this vulnerability, upgrade all affected Dbt core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

dbt-core fixed: 1.6.13
pip install dbt-core>=1.6.13
dbt-core fixed: 1.7.13
pip install dbt-core>=1.7.13
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show dbt-core

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-p72q-h37j-3hq7, inspect your installed packages using pip:

pip show dbt-core

Analyze the terminal output to locate any version of Dbt core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.13), your application is affected.

Note: The pip show dbt-core command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-673: External Influence of Sphere Definition, where the product does not prevent the definition of control spheres from external actors. In Dbt core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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: ```sh 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: ```python 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](https://github.com/dbt-labs/dbt-core/releases/tag/v1.6.13) and [dbt-core v1.7.13](https://github.com/dbt-labs/dbt-core/releases/tag/v1.7.13). ### Mitigations Bump `dbt-core` 1.6 and 1.7 dependencies to 1.6.13 and 1.7.13 respectively

GHSA-p72q-h37j-3hq7 Affected Dbt core Versions

2 component(s)
Fixed Versions:
1.6.131.7.13
Product / Package Ecosystem Affected Versions Fixed Version
dbt-core
PyPI
≥ 1.6.0
< 1.6.13
1.6.13
dbt-core
PyPI
≥ 1.7.0
< 1.7.13
1.7.13

References

Frequently Asked Questions

What is GHSA-p72q-h37j-3hq7?
GHSA-p72q-h37j-3hq7 is a security vulnerability in Dbt core involving dbt uses a SQLparse version with a high vulnerability under CWE-673: External Influence of Sphere Definition.
Which Dbt core versions are affected?
Affected versions include releases prior to 1.6.13, 1.7.13 across affected packages: dbt-core.
What version fixes GHSA-p72q-h37j-3hq7?
Upgrading to 1.6.13, 1.7.13 (or the latest patched release for your respective branch) resolves the vulnerability.
Is dbt-core affected?
Yes, dbt-core is affected in releases prior to 1.6.13, 1.7.13. Upgrade your dependency to 1.6.13, 1.7.13 or later.
What is the CVSS score of GHSA-p72q-h37j-3hq7?
GHSA-p72q-h37j-3hq7 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-p72q-h37j-3hq7?
GHSA-p72q-h37j-3hq7 is classified under CWE-673: External Influence of Sphere Definition (The product does not prevent the definition of control spheres from external actors.).
How can I check PyPI dependencies for GHSA-p72q-h37j-3hq7?
Run the dependency tree command: 'pip show dbt-core'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p72q-h37j-3hq7",
  "modified" : "2024-04-22T22:18:56Z",
  "published" : "2024-04-22T22:17:59Z",
  "aliases" : [ ],
  "summary" : "dbt uses a SQLparse version with a high vulnerability",
  "details" : "### Summary\n\nUsing 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`.\n\n### Details\nDependency conflict error message:\n```sh\nThe conflict is caused by:\n    The user requested sqlparse==0.5\n    dbt-core 1.7.10 depends on sqlparse<0.5 and >=0.2.3\n```\nResolution was to pin `sqlparse >=0.5.0, <0.6.0` in `dbt-core`, patched in 1.6.13 and 1.7.13.\n\n### PoC\nFrom Snyk:\n\n```python\nimport sqlparse\nsqlparse.parse('[' * 10000 + ']' * 10000)\n```\n\n### Impact\nSnyk classifies it as high 7.5/10.\n\n### Patches\nThe bug has been fixed in [dbt-core v1.6.13](https://github.com/dbt-labs/dbt-core/releases/tag/v1.6.13) and [dbt-core v1.7.13](https://github.com/dbt-labs/dbt-core/releases/tag/v1.7.13).\n\n### Mitigations\nBump `dbt-core` 1.6 and 1.7 dependencies to 1.6.13 and 1.7.13 respectively",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "dbt-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0"
      }, {
        "fixed" : "1.6.13"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "dbt-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.7.0"
      }, {
        "fixed" : "1.7.13"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-2m57-hf25-phgg"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dbt-labs/dbt-core/security/advisories/GHSA-p72q-h37j-3hq7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dbt-labs/dbt-core"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-PYTHON-SQLPARSE-6615674"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-673" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-22T22:17:59Z",
    "nvd_published_at" : null
  }
}