CVE-2024-40637 Implicit override for built-in materializations from installed packages in dbt-core

Medium 4.2 Published Updated

Malicious dbt packages can implicitly override built-in materializations to execute arbitrary code, requiring users to upgrade dbt-core.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2024-40637?

CVE-2024-40637 is a medium-severity code injection vulnerability in dbt-labs dbt-core, published on 16 Jul 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications. When a user installs a package in dbt, it has the ability to override macros, materializations, and other core components of dbt. This is by design, as it allows packages to extend and customize dbt's functionality. However, this also means that a malicious package could potentially override these components with harmful code. This issue has been fixed in versions 1.8.0, 1.6.14 and 1.7.14. Users are advised to upgrade. There are no kn own workarounds for this vulnerability. Users updating to either 1.6.14 or 1.7.14 will need to set `flags.require_explicit_package_overrides_for_builtin_materializations: False` in their configuration in `dbt_project.yml`.

Weakness: CWE-89, CWE-74

Which versions are affected by CVE-2024-40637?

5 open source packages ship an affected version, including dbt-core. It affects 1 product.

PackageAffectedFixed in
dbt-core PyPIFrom 1.6.01.6.14
dbt-core PyPIFrom 1.6.01.6.14
dbt-core PyPIFrom 1.7.01.7.14, 1.6.14
dbt-core PyPIFrom 1.7.01.7.14
dbt-core PyPIFrom 1.7.01.7.14

Products include Getdbt Dbt Core.

How do I fix CVE-2024-40637?

Upgrade dbt-core to a fixed version for your release line: 1.6.14 or 1.7.14.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2024-40637 being exploited?

There is no known exploitation of CVE-2024-40637 in the wild and no public exploit code.

Sources

Also known as GHSA-p3f3-5ccg-83xq, PYSEC-2024-66.

Is CVE-2024-40637 in your software?

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

Check your SBOMs for free