---
id: CVE-2026-29509
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 char…
severity: medium
cvss: 5.4
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N'
cvssSource: cna
cwe:
  - CWE-22
vendor: wummel
product: patool
affected:
  - patool < 4.0.5
ssvc:
  exploitation: none
  automatable: 'no'
  technicalImpact: partial
  timestamp: '2026-06-27T03:03:15.517374Z'
published: '2026-06-26'
updated: '2026-11-08'
sourceUpdated: '2026-11-08T14:01:53.523Z'
source: CVEORG
sourceUrl: 'https://www.cve.org/CVERecord?id=CVE-2026-29509'
references:
  - url: 'https://github.com/wummel/patool/releases/tag/4.0.5'
    label: patool 4.0.5 Release Notes
  - url: 'https://github.com/wummel/patool/blob/main/doc/changelog.txt'
  - url: >-
      https://www.vulncheck.com/advisories/patool-path-traversal-via-safe-extract-function
tags:
  - cve.org
epss: 0.00371
epssPercentile: 0.31296
ingestedAt: '2026-11-08T14:51:22.460Z'
---

## Overview

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.

## Affected

- `patool < 4.0.5`

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
