ghsa-w2gf-jxc9-pf2q
Vulnerability from github
Published
2025-01-21 21:07
Modified
2025-01-21 21:07
Summary
sniff_csv provides filesystem access even when enable_external_access is disabled in duckdb
Details

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.

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "duckdb"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.0.0"
            },
            {
              "fixed": "1.1.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2024-41672"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-200"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-01-21T21:07:56Z",
    "nvd_published_at": "2024-07-24T18:15:05Z",
    "severity": "HIGH"
  },
  "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(\u0027/proc/self/environ\u0027);\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(\u0027/proc/self/environ\u0027)` 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\u0027t seem to be the intent of the sniff_csv function (my understanding is it\u0027s 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=\u0027LocalFileSystem\u0027;\nSET lock_configuration=true;\n\nSELECT Columns FROM sniff_csv(\u0027/proc/self/environ\u0027);\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",
  "id": "GHSA-w2gf-jxc9-pf2q",
  "modified": "2025-01-21T21:07:56Z",
  "published": "2025-01-21T21:07:56Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "sniff_csv provides filesystem access even when enable_external_access is disabled in duckdb"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.