Description
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 products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| wummel | patool | < 4.0.5 | 4.0.5 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | patool | 4.0.5-0.1 | — |
| Debian 13 | patool | 4.0.0-1+deb13u1 | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.04 LTS | patool | No fix yet | — |
| Ubuntu 25.10 | patool | No fix yet | — |
| Ubuntu 24.04 LTS | patool | No fix yet | — |
| Ubuntu 22.04 LTS | patool | No fix yet | — |
| Ubuntu 20.04 LTS | patool | No fix yet | — |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 18.04 LTS | patool | No fix yet | — |
| Ubuntu 16.04 LTS | patool | No fix yet | — |
References
- patool 4.0.5 Release Notes patch release-notes
- https://github.com/wummel/patool/blob/main/doc/changelog.txt release-notes
- https://www.vulncheck.com/advisories/patool-path-traversal-via-safe-extract-function third-party-advisory