Skip to content
Heist/ feed
Back to feed
Medium

Patool < 4.0.5 Path Traversal via safe_extract() Function

Type: advisorySources: OSV

Patool before 4.0.5 contains a path traversal vulnerability in the safe_extract() function in patoolib/programs/py_tarfile.py when running on Python before 3.12, where the is_within_directory() helper uses os.path.commonprefix() for character-level string comparison instead of path-level comparison, allowing a crafted archive member path to bypass the containment check. Attackers can supply a malicious archive with specially crafted member paths to write arbitrary files.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-29509
Confirmed fixed CVEs
Not specified
Updated in this feed
3 Nov 2026, 01:39 UTC · Revision 1

Source evidence

Patool < 4.0.5 Path Traversal via safe_extract() Function

core-osv · Original source

Published 26 Jun 2026, 19:31 UTC

Patool before 4.0.5 contains a path traversal vulnerability in the safe_extract() function in patoolib/programs/py_tarfile.py when running on Python before 3.12, where the is_within_directory() helper uses os.path.commonprefix() for character-level string comparison instead of path-level comparison, allowing a crafted archive member path to bypass the containment check. Attackers can supply a malicious archive with specially crafted member paths to write arbitrary files.

osv:CVE-2026-29509
Complete source record
{
  "id": "18204ad8d7cc9154c9048e74aabc3624435b6b171255ecb4c98fcf96c218dab5",
  "url": "https://osv.dev/vulnerability/CVE-2026-29509",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Patool < 4.0.5 Path Traversal via safe_extract() Function",
    "summary": "Patool before 4.0.5 contains a path traversal vulnerability in the safe_extract() function in patoolib/programs/py_tarfile.py when running on Python before 3.12, where the is_within_directory() helper uses os.path.commonprefix() for character-level string comparison instead of path-level comparison, allowing a crafted archive member path to bypass the containment check. Attackers can supply a malicious archive with specially crafted member paths to write arbitrary files.",
    "evidence": "osv:CVE-2026-29509",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-29509",
      "aliases": [
        "CVE-2026-29509"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/wummel/patool",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "3a6595327174c37937bb8af5c9cf6ad9d0ce79cc"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "4.0.5"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StandardRange"
                  },
                  {
                    "range": [
                      {
                        "fixed": "3a6595327174c37937bb8af5c9cf6ad9d0ce79cc"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "4.0.5"
                  },
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "4.0.5"
                      }
                    ],
                    "source": "DESCRIPTION"
                  }
                ]
              }
            }
          ],
          "versions": [
            "4.0.4",
            "4.0.3",
            "4.0.2",
            "4.0.1",
            "4.0.0",
            "3.1.3",
            "3.1.2",
            "3.1.1",
            "3.1.0",
            "3.0.3",
            "3.0.2",
            "3.0.1",
            "3.0.0",
            "2.4.0",
            "upstream/2.4.0",
            "dist/patool-2.4.0-py2.py3-none-any.whl",
            "upstream/2.3.0",
            "upstream/2.2.0",
            "upstream/2.1.1",
            "upstream/2.1.0",
            "upstream/2.0.0",
            "upstream/1.15.0",
            "upstream/1.14.1",
            "upstream/1.14.0",
            "upstream/1.13",
            "upstream/1.12",
            "upstream/1.11",
            "upstream/1.10",
            "upstream/1.9",
            "upstream/1.8",
            "upstream/1.7",
            "upstream/1.6",
            "upstream/1.5",
            "upstream/1.4",
            "upstream/1.2",
            "upstream/1.1",
            "upstream/1.0",
            "upstream/0.19",
            "upstream/0.18"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-29509.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:25.084716904Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/29xxx/CVE-2026-29509.json",
        "https://github.com/wummel/patool/blob/main/doc/changelog.txt",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-29509",
        "https://www.vulncheck.com/advisories/patool-path-traversal-via-safe-extract-function",
        "https://github.com/wummel/patool/releases/tag/4.0.5",
        "https://github.com/wummel/patool"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-22"
        ],
        "cna_assigner": "VulnCheck",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/29xxx/CVE-2026-29509.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-29509",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 491682,
  "published_at": "2026-06-26T19:31:07.165+00:00"
}