/

CVE-2026-106057

Severity:

HIGH RISK

(7.8)

OS Command Injection (CWE-78) in patool on Windows

CVE-2026-106057

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

patool before 4.0.6 may allow OS command injection on Windows when crafted archive filenames are incorporated into commands executed through cmd.exe. An attacker who can supply or influence filenames processed in supported single-file formats could execute commands with the privileges of the patool process.

patool before 4.0.6 may allow OS command injection on Windows when crafted archive filenames are incorporated into commands executed through cmd.exe. An attacker who can supply or influence filenames processed in supported single-file formats could execute commands with the privileges of the patool process.

Affected context

The issue can occur in Windows deployments of patool that process attacker-controlled archive filenames and invoke external commands with shell execution enabled. Risk is higher when the filename reaches a command-building path where Windows shell metacharacters or embedded double quotes are not safely escaped.

The issue can occur in Windows deployments of patool that process attacker-controlled archive filenames and invoke external commands with shell execution enabled. Risk is higher when the filename reaches a command-building path where Windows shell metacharacters or embedded double quotes are not safely escaped.

Exploit preconditions

  • Attack surface: Windows command execution performed by patool during archive processing
  • Required access: Ability to provide or influence an archive filename processed by patool
  • Trigger point: Handling of a filename for a supported single-file archive format when the command is run with shell execution enabled
  • Why exploitation is possible: The Windows quoting routine does not sufficiently escape cmd.exe metacharacters or embedded double quotes, allowing filename content to alter command interpretation
  • Attack surface: Windows command execution performed by patool during archive processing
  • Required access: Ability to provide or influence an archive filename processed by patool
  • Trigger point: Handling of a filename for a supported single-file archive format when the command is run with shell execution enabled
  • Why exploitation is possible: The Windows quoting routine does not sufficiently escape cmd.exe metacharacters or embedded double quotes, allowing filename content to alter command interpretation

Why this happens

The vulnerability results from incomplete Windows shell argument escaping in shell_quote_nt. Characters with control meaning to cmd.exe, including command separators and redirection operators, can remain active when a filename is incorporated into a shell command. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because externally influenced data is passed to a command interpreter without reliable neutralization.

The vulnerability results from incomplete Windows shell argument escaping in shell_quote_nt. Characters with control meaning to cmd.exe, including command separators and redirection operators, can remain active when a filename is incorporated into a shell command. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because externally influenced data is passed to a command interpreter without reliable neutralization.

Potential impact

  • An attacker may execute arbitrary operating-system commands
  • The patool process and its accessible files may be compromised
  • Sensitive data may be read, modified, or deleted
  • Malicious software could be installed using the process account's privileges
  • Compromise could spread to connected systems or workflows depending on deployment permissions
  • An attacker may execute arbitrary operating-system commands
  • The patool process and its accessible files may be compromised
  • Sensitive data may be read, modified, or deleted
  • Malicious software could be installed using the process account's privileges
  • Compromise could spread to connected systems or workflows depending on deployment permissions

General mitigation guidance

Mitigation generally focuses on eliminating shell interpretation and reducing trust in archive metadata.

Common defensive patterns include:

  • Prefer direct process execution with argument arrays instead of shell=True
  • Use a well-tested platform-specific quoting routine when shell invocation cannot be avoided
  • Treat archive filenames and other metadata as untrusted input
  • Apply strict filename validation and reject unexpected command metacharacters where appropriate
  • Run archive processing with least-privilege accounts and restricted filesystem access
  • Isolate archive extraction and conversion workloads from sensitive services
  • Apply resource, filesystem, and network restrictions to processing workers

Mitigation generally focuses on eliminating shell interpretation and reducing trust in archive metadata.

Common defensive patterns include:

  • Prefer direct process execution with argument arrays instead of shell=True
  • Use a well-tested platform-specific quoting routine when shell invocation cannot be avoided
  • Treat archive filenames and other metadata as untrusted input
  • Apply strict filename validation and reject unexpected command metacharacters where appropriate
  • Run archive processing with least-privilege accounts and restricted filesystem access
  • Isolate archive extraction and conversion workloads from sensitive services
  • Apply resource, filesystem, and network restrictions to processing workers

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings involving shell=True, string-based command construction, and concatenation of archive metadata into commands
  • Code-review signals such as custom shell-quoting helpers or platform-specific escaping without comprehensive metacharacter handling
  • Tests using adversarial filenames containing command separators, redirection characters, substitutions, and embedded quotes
  • Runtime monitoring for unexpected child processes, command interpreters, or network connections spawned by archive-processing services
  • Policy enforcement that blocks shell execution for untrusted input and requires approved process-launch APIs

Automated code-review and software-composition tools may help identify related command-injection patterns.

Organizations can look for:

  • Static-analysis findings involving shell=True, string-based command construction, and concatenation of archive metadata into commands
  • Code-review signals such as custom shell-quoting helpers or platform-specific escaping without comprehensive metacharacter handling
  • Tests using adversarial filenames containing command separators, redirection characters, substitutions, and embedded quotes
  • Runtime monitoring for unexpected child processes, command interpreters, or network connections spawned by archive-processing services
  • Policy enforcement that blocks shell execution for untrusted input and requires approved process-launch APIs

Automated code-review and software-composition tools may help identify related command-injection patterns.

Sources

SourceLink
github.comgithub.com/wummel/patool
github.comgithub.com/wummel/patool/blob/4.0.5/patoolib/util.py#L110-L116
github.comgithub.com/wummel/patool/commit/592f35761f428afbcde2888ecd3cc4af43881aeb
vulncheck.comvulncheck.com/advisories/patool-before-4.0.6-os-command-injection-on-windows-via-shell-quote-nt

Frequently asked

questions

It can be exploitable through a remote workflow when an attacker can submit an archive or otherwise control the filename processed by a Windows-hosted patool service. In local-only deployments, the attacker generally needs access to the archive-processing input path.

The key requirement is the ability to influence a filename that reaches the vulnerable command-execution path. The resulting commands run with the privileges available to patool.

Avoid invoking a shell for external tools and pass validated arguments through a direct process-execution interface. If shell use is unavoidable, use a maintained, platform-appropriate escaping mechanism and narrowly constrain accepted filenames.

Treat archive metadata as untrusted, test command boundaries with adversarial filenames, enforce least privilege, and use static analysis and code-review policies that flag shell-based execution.

It can be exploitable through a remote workflow when an attacker can submit an archive or otherwise control the filename processed by a Windows-hosted patool service. In local-only deployments, the attacker generally needs access to the archive-processing input path.

The key requirement is the ability to influence a filename that reaches the vulnerable command-execution path. The resulting commands run with the privileges available to patool.

Avoid invoking a shell for external tools and pass validated arguments through a direct process-execution interface. If shell use is unavoidable, use a maintained, platform-appropriate escaping mechanism and narrowly constrain accepted filenames.

Treat archive metadata as untrusted, test command boundaries with adversarial filenames, enforce least privilege, and use static analysis and code-review policies that flag shell-based execution.

Find out what's already
exploitable in your codebase.