CVE-2026-100368: CliInvoke.Specializations: Command injection in PowerShell and Cmd shell wrappers
Impact An OS command injection vulnerability exists in the PowerShell and Cmd shell wrappers provided by the CliInvoke.Specializations package (the PowershellProcessInvoker/CmdProcessInvoker invokers, and the UsePowerShell/UseCmd middleware in v3 pre-release versions).
The wrappers re-run a caller-supplied target and arguments inside a shell command (pwsh -Command ... / cmd /c ...). In affected versions the wrapped command was delivered to the operating system as a single ProcessStartInfo.Arguments string. The OS command-line parser re-tokenizes that string before the shell parses it, so a double quote (") in the target or arguments breaks OS-level quoting and lets the wrapped shell reassemble a second, unintended command.
An attacker could exploit this to execute arbitrary commands with the privileges of the host process.
Patches The Specializations Packages now deliver the command via ProcessStartInfo.ArgumentList (natively where supported, and polyfilled in older TFMs), so that the operating system passes argv verbatim and only the shell parses the command once.
Upgrade to: - 2.8.5 (2.8.x line) - 2.9.4 (2.9.x line) - 2.10.5 (2.10.x line) - 3.0.0-beta.1 (3.x pre-release line)
Workarounds No complete workaround is available. Until upgraded:
- Reject or strip " from any target path or argument passed to the PowerShell/Cmd wrappers. On 2.2.0 – 2.9.2 and 3.0.0-alpha.1 – alpha.4, also reject shell metacharacters (;, |, &, $, backtick, parentheses). - Alternatively, bypass the wrappers for untrusted input and invoke the target process directly so that no second shell parse of the data occurs.
Other sources
CliInvoke is a .NET library for invoking command-line programs, and its CliInvoke.Specializations packages provide specialized wrappers for shells such as PowerShell and Windows Command Prompt. CliInvoke.Specializations versions 2.2.0 through 2.8.4, 2.9.0 through 2.9.3, 2.10.0 through 2.10.4, 3.0.0-alpha.1 through 3.0.0-alpha.4, and 3.0.0-alpha.8 through 3.0.0-alpha.10, as well as AlastairLundy.CliInvoke.Specializations versions 1.0.0-rc.1 through 1.6.1.1, contain an OS command injection vulnerability in their PowerShell and Cmd wrappers. The wrappers pass a caller-controlled target and arguments to pwsh -Command or cmd /c using a single ProcessStartInfo.Arguments string, allowing a double quote in untrusted input to break operating-system-level quoting and cause the shell to execute an additional command with the host process's privileges. The vulnerability is patched in CliInvoke.Specializations versions 2.8.5, 2.9.4, 2.10.5, and 3.0.0-beta.1, and in AlastairLundy.CliInvoke.Specializations version 2.0.2. No complete workaround is available; users unable to upgrade should reject or remove double quotes from target paths and arguments, additionally reject shell metacharacters in versions 2.2.0 through 2.9.2 and 3.0.0-alpha.1 through 3.0.0-alpha.4, or bypass the PowerShell and Cmd wrappers and invoke target processes directly when handling untrusted input.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
nuget/AlastairLundy.CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.0.2 - Upgrade
Upgrade
nuget/CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 3.0.0-beta.1 - Upgrade
Upgrade
nuget/CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.10.5 - Upgrade
Upgrade
nuget/CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.9.4 - Upgrade
Upgrade
nuget/CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.8.5 - Upgrade
Upgrade
CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.8.5 - Upgrade
Upgrade
CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.9.4 - Upgrade
Upgrade
CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.10.5 - Upgrade
Upgrade
CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 3.0.0-beta.1 - Upgrade
Upgrade
AlastairLundy.CliInvoke.Specializationsto a version that resolves this vulnerability.Fixed in 2.0.2 - Compensating control
Until upgraded, bypass the PowerShell and Cmd wrappers for untrusted input and invoke the target process directly so the data is not subject to a second shell parse.
- Compensating control
Until upgraded, reject or remove double quotes (") from target paths and arguments; for CliInvoke.Specializations versions 2.2.0 through 2.9.2 and 3.0.0-alpha.1 through 3.0.0-alpha.4, also reject shell metacharacters: ;, |, &, $, backtick, and parentheses.
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using the affected PowerShell or Cmd wrappers in the listed CliInvoke.Specializations or AlastairLundy.CliInvoke.Specializations versions are exposed when a caller-controlled target path or argument reaches those wrappers. The issue affects Windows Command Prompt and PowerShell invocation paths, not necessarily every use of the underlying library.
What does an attacker need to exploit it?
An attacker needs to control all or part of a target or argument supplied to an affected wrapper and include a double quote that breaks the operating-system-level quoting. Exploitation does not require privileges or user interaction, but is local according to the supplied severity vector.
What is the impact of successful exploitation?
The attacker can cause the shell to execute an additional command with the privileges of the host process. The supplied severity information indicates high impacts to confidentiality, integrity, and availability.
Which versions fix the issue?
Upgrade CliInvoke.Specializations to 2.8.5, 2.9.4, 2.10.5, or 3.0.0-beta.1, as appropriate for the version line in use. Upgrade AlastairLundy.CliInvoke.Specializations to 2.0.2.
What can be done if an upgrade is not immediately possible?
There is no complete workaround. Reject or remove double quotes from target paths and arguments, and additionally reject shell metacharacters from untrusted input.