Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-106057 Overview
CVE-2026-106057 is an OS command injection vulnerability [CWE-78] in the patool archive handling library on Windows. Versions before 4.0.6 contain a flawed shell_quote_nt function that fails to escape cmd.exe metacharacters or embedded double quotes in archive filenames. An attacker who supplies a crafted filename such as report&calc.gz for single-file archive formats processed with shell=True can execute arbitrary commands with the privileges of the patool process. The vulnerability affects local attack scenarios where a user is induced to process a malicious archive filename.
Critical Impact
Attackers can achieve arbitrary command execution on Windows systems by tricking users into processing archives with weaponized filenames, inheriting the privileges of the invoking process.
Affected Products
- patool versions before 4.0.6 on Windows
- Applications and scripts that invoke patool to handle attacker-controlled archive filenames
- Automation pipelines on Windows that process untrusted single-file archive formats (e.g., .gz)
Discovery Timeline
- 2026-10-07 - CVE CVE-2026-106057 published to NVD
- 2026-10-07 - Last updated in NVD database
Technical Details for CVE-2026-106057
Vulnerability Analysis
The vulnerability resides in the shell_quote_nt helper function within patoolib/util.py. The pre-patch implementation only wrapped values containing a space in double quotes and performed no further escaping. On Windows, cmd.exe interprets a wide range of metacharacters including &, |, <, >, (, ), ^, !, and ". When patool invokes external archive handlers with shell=True and interpolates an attacker-controlled filename, those metacharacters break out of the intended argument context and run adjacent commands.
Single-file archive formats such as .gz are the primary trigger because the output filename is derived from the input filename and passed directly into a shell command line. A filename like report&calc.gz resolves into a command string where calc executes after the archive operation.
Root Cause
The root cause is incomplete input sanitization in shell_quote_nt. The function assumed that space handling was sufficient for safe interpolation into a Windows shell command. It did not escape cmd.exe metacharacters, nor did it handle embedded double quotes or percent-based variable expansion. Combined with callers that use shell=True, this produces a classic command injection sink.
Attack Vector
Exploitation requires local access and user interaction: a victim must process an archive whose filename contains shell metacharacters. The payload runs with the privileges of the patool process. Delivery vectors include archives extracted from email, download directories, shared drives, or any workflow that feeds untrusted filenames into patool on Windows.
# Security patch in patoolib/util.py - escape Windows cmd metacharacters
# Source: https://github.com/wummel/patool/commit/592f35761f428afbcde2888ecd3cc4af43881aeb
def shell_quote_nt(value: str) -> str:
"""Quote argument for Windows systems."""
quoted_value = value
# meta characters for windows systems
nt_meta_chars = '^:&|<>()"!'
# quote all meta characters with ^
for c in nt_meta_chars:
quoted_value = quoted_value.replace(c, f"^{c}")
# quote percent with percent
quoted_value = quoted_value.replace('%', '%%')
# finally wrap in double quotes
return f'"{quoted_value}"'
The fix caret-escapes each metacharacter, doubles % to neutralize variable expansion, and wraps the full value in double quotes before interpolation into a shell command.
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-106057
Indicators of Compromise
- Archive filenames on Windows hosts containing shell metacharacters such as &, |, (, ), <, >, ^, or ! immediately before an extension like .gz
- python.exe or scripts invoking patool spawning unexpected child processes such as cmd.exe, powershell.exe, or arbitrary binaries
- Process command lines where archive paths are concatenated with additional commands separated by & or |
Detection Strategies
- Hunt for process trees where a patool invocation is the parent of unrelated interactive shells or living-off-the-land binaries
- Inspect file-write and download telemetry for .gz, .bz2, .xz, and other single-file archive formats whose filenames contain cmd.exe metacharacters
- Review Python application logs and automation pipelines on Windows for failures or anomalies around archive extraction tasks
Monitoring Recommendations
- Enable Windows process creation auditing (Event ID 4688) with command-line logging to capture full argument strings passed to shells
- Baseline the expected child processes of any application that calls patool and alert on deviations
- Monitor software inventories for installations of patool prior to version 4.0.6 across Windows endpoints and build servers
How to Mitigate CVE-2026-106057
Immediate Actions Required
- Upgrade patool to version 4.0.6 or later on all Windows systems and build pipelines
- Audit internal tools, scripts, and services that embed patool as a dependency and redeploy with the patched release
- Validate archive filenames against a strict allowlist before passing them to patool or any shell-executed utility
Patch Information
The fix is delivered in patool 4.0.6 via commit 592f357, which rewrites shell_quote_nt to escape Windows cmd.exe metacharacters with ^, double percent signs, and wrap the resulting value in double quotes. See the Vulncheck Advisory on patool and the GitHub commit 592f357 for the full diff.
Workarounds
- Rename or reject archive files whose names contain any of ^ : & | < > ( ) " ! or % before invoking patool
- Avoid processing untrusted archives on Windows until the patched version is deployed; perform extraction in a Linux container where the vulnerable code path does not apply
- Where feasible, invoke archive utilities directly with argument lists instead of shell=True wrappers
# Upgrade patool to the patched release
pip install --upgrade "patool>=4.0.6"
# Verify installed version
python -c "import patoolib; print(patoolib.__version__)"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

