Vulnerabilities in pkg:pypi/duckdb

PACKAGE
Advisory Identifier: GHSA-w2gf-jxc9-pf2q
Advisory Summary

CVE-2024-41672 is a HIGH (CVSS 7.5) sniff_csv provides filesystem access even vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Duckdb libraries in the PyPI ecosystem. The issue involves sniff_csv provides filesystem access even when enable_external_access is disabled in duckdb. Remediation is available by upgrading affected packages to version 1.1.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/duckdb

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/duckdb. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-w2gf-jxc9-pf2q CVE-2024-41672 HIGH sniff_csv provides filesystem access even when enable_external_access is disabled in duckdb

CVE-2024-41672 at a Glance

CVE Identifier CVE-2024-41672
GHSA Identifier GHSA-w2gf-jxc9-pf2q
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Duckdb
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:H/I:N/A:N).

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 High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-41672

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

duckdb fixed: 1.1.0
pip install duckdb>=1.1.0
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 duckdb

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-41672, inspect your installed packages using pip:

pip show duckdb

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Duckdb, 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 Content in filesystem is accessible for reading using `sniff_csv`, even with `enable_external_access=false`. ### Details During a pentest, a security researcher was able to access environment variable data and other system data by using the `sniff_csv` function, even though we set `enable_external_access` to false. ### PoC ```SQL SET enable_external_access=false; SET lock_configuration=true; SELECT Columns FROM sniff_csv('/proc/self/environ'); ``` ### Impact Provides an attacker with access to filesystem even when access is expected to be disabled and other similar functions do NOT provide access. For example `select * from read_csv('/proc/self/environ')` fails with a permission error. There seems to be two vectors to this vulnerability: 1. Access to files that should otherwise not be allowed. (We expect `Permission Error: Scanning CSV files is disabled through configuration` and not to provide any access to the file or even acknowledge that it exists). 2. The content from a (non-csv?) file can be read (e.g. `/etc/hosts`, `proc/self/environ`, etc) even though that doesn't seem to be the intent of the sniff_csv function (my understanding is it's intending to provide information about the shape of the data, but not provide the data itself). ### Workaround It is possible to work around the issue by disabling the local file system using the `disabled_filesystems` setting: ```SQL SET disabled_filesystems='LocalFileSystem'; SET lock_configuration=true; SELECT Columns FROM sniff_csv('/proc/self/environ'); ``` will result in `Permission Error: File system LocalFileSystem has been disabled by configuration`. ### Fix A fix has been merged into the `main` branch (https://github.com/duckdb/duckdb/pull/13133), and will be released with the next DuckDB release.

CVE-2024-41672 Affected Duckdb Versions

1 component(s)
Fixed Versions:
1.1.0
Product / Package Ecosystem Affected Versions Fixed Version
duckdb
PyPI
≥ 1.0.0
< 1.1.0
1.1.0

References

Frequently Asked Questions

What is CVE-2024-41672?
CVE-2024-41672 is a security vulnerability in Duckdb involving sniff_csv provides filesystem access even when enable_external_access is disabled in duckdb under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Duckdb versions are affected?
Affected versions include releases prior to 1.1.0 across affected packages: duckdb.
What version fixes CVE-2024-41672?
Upgrading to 1.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is duckdb affected?
Yes, duckdb is affected in releases prior to 1.1.0. Upgrade your dependency to 1.1.0 or later.
What is the CVSS score of CVE-2024-41672?
CVE-2024-41672 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:H/I:N/A:N.
What CWE is associated with CVE-2024-41672?
CVE-2024-41672 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check PyPI dependencies for CVE-2024-41672?
Run the dependency tree command: 'pip show duckdb'. 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-w2gf-jxc9-pf2q",
  "modified" : "2025-01-21T21:07:56Z",
  "published" : "2025-01-21T21:07:56Z",
  "aliases" : [ "CVE-2024-41672" ],
  "summary" : "sniff_csv provides filesystem access even when enable_external_access is disabled in duckdb",
  "details" : "### Summary\nContent in filesystem is accessible for reading using `sniff_csv`, even with `enable_external_access=false`. \n\n### Details\nDuring a pentest, a security researcher was able to access environment variable data and other system data by using the `sniff_csv` function, even though we set `enable_external_access` to false. \n\n### PoC\n```SQL\nSET enable_external_access=false;\nSET lock_configuration=true;\n\nSELECT Columns FROM sniff_csv('/proc/self/environ');\n```\n\n### Impact\nProvides an attacker with access to filesystem even when access is expected to be disabled and other similar functions do NOT provide access. \n\nFor example `select * from read_csv('/proc/self/environ')` fails with a permission error. \n\nThere seems to be two vectors to this vulnerability: \n1. Access to files that should otherwise not be allowed. (We expect `Permission Error: Scanning CSV files is disabled through configuration` and not to provide any access to the file or even acknowledge that it exists). \n2. The content from a (non-csv?) file can be read (e.g. `/etc/hosts`, `proc/self/environ`, etc) even though that doesn't seem to be the intent of the sniff_csv function (my understanding is it's intending to provide information about the shape of the data, but not provide the data itself). \n\n### Workaround\nIt is possible to work around the issue by disabling the local file system using the `disabled_filesystems` setting:\n```SQL\nSET disabled_filesystems='LocalFileSystem';\nSET lock_configuration=true;\n\nSELECT Columns FROM sniff_csv('/proc/self/environ');\n```\n\nwill result in `Permission Error: File system LocalFileSystem has been disabled by configuration`.\n\n### Fix\nA fix has been merged into the `main` branch (https://github.com/duckdb/duckdb/pull/13133), and will be released with the next DuckDB release.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "duckdb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/duckdb/duckdb/security/advisories/GHSA-w2gf-jxc9-pf2q"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-41672"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/duckdb/duckdb/pull/13133"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/duckdb/duckdb/commit/c9b7c98aa0e1cd7363fe8bb8543a95f38e980d8a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/duckdb/duckdb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/duckdb/PYSEC-2024-203.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-01-21T21:07:56Z",
    "nvd_published_at" : "2024-07-24T18:15:05Z"
  }
}