Sep 26, 2026·7 min read·19 visits
Flaw in CliInvoke shell wrappers allows unauthenticated local attackers to execute arbitrary OS commands via crafted double-quote characters in target paths or execution arguments.
An OS command injection vulnerability exists in the PowerShell and Cmd shell wrappers of the CliInvoke .NET library (specifically the CliInvoke.Specializations package). Under vulnerable configurations, arguments and targets are passed as a single flat string to ProcessStartInfo.Arguments, permitting double-quote breakout and execution of arbitrary secondary commands with host process privileges.
The CliInvoke.Specializations package provides specialized wrappers to execute external targets using shell interpreters such as Windows Command Prompt (cmd.exe) and PowerShell (powershell.exe/pwsh). These wrappers are implemented through components like PowershellProcessInvoker, CmdProcessInvoker, and middleware components like UsePowerShell and UseCmd in v3 pre-releases. Their design simplifies executing utilities in a shell-managed environment but expands the system attack surface when untrusted inputs are passed as parameters.
The primary exposure vector occurs when user-controlled data is passed as either the executable target path or the command arguments to these wrappers. In vulnerable versions, the library attempts to concatenate these parameters into a unified command string. The core vulnerability is categorized as CWE-78 (OS Command Injection) because the input escaping and validation logic fails to neutralize the semantic impact of double quotes (").
Process creation on Windows environments using the standard .NET System.Diagnostics.Process library eventually interacts with the Win32 CreateProcessW API. Unlike Unix-like environments that natively execute programs via array-based execve calls, Windows processes take command line parameters as a single, serialized Unicode string. When an application passes arguments using the legacy ProcessStartInfo.Arguments property, the .NET runtime passes this string directly to the target executable.
In vulnerable configurations of CliInvoke.Specializations, the library consolidated the path of the target and its arguments into one flat string. The library then applied custom character-escaping operations, such as adding the Windows command prompt escape caret (^) or the PowerShell backtick (`) to suspect metacharacters. This sanitization strategy incorrectly assumed that the shell interpreter would process the string first.
However, because the command line is passed as a flat string to the operating system, Windows executes its internal tokenization routine (typically matching CommandLineToArgvW rules) to find the program boundary before loading the shell interpreter (cmd.exe or pwsh.exe). If the input contains a double quote ("), it pairs with other quotes in the constructed command line to invert or break the outer quoting context. This splits the single argument into multiple distinct OS-level arguments, allowing attackers to introduce shell control operators that bypass the library's custom escape functions.
In the vulnerable codebase, RunnerProcessFactory.cs managed the wrapping logic by formatting commands directly into combinedArgs using basic string operations and specialized escaping helpers.
// VULNERABLE CODE BLOCK
// The target and arguments were escaped and formatted into a single string.
string safeTarget = ShellArgumentEscaper.EscapeForCmd(processConfigToBeRun.TargetFilePath);
string safeArguments = ShellArgumentEscaper.EscapeForCmd(processConfigToBeRun.Arguments);
combinedArgs = $\"{prefix} \\\"{safeTarget}\\\" {suffix}\".Trim();This approach allowed a single double-quote inside processConfigToBeRun.Arguments to close the surrounding quote block prematurely. The patched version resolved this by switching completely to structured token arrays. Instead of passing strings to ProcessStartInfo.Arguments, the system splits the arguments programmatically using a newly introduced ArgumentTokenizer class and delivers them to the process using the ProcessStartInfo.ArgumentList collection.
// PATCHED CODE BLOCK (ArgumentTokenizer.cs - Commit 1e98582f02eb43e345e5b97b8dd6ff9443806685)
// Splits the command-line argument string into discrete tokens.
internal static class ArgumentTokenizer
{
internal static IReadOnlyList<string> Tokenize(string? value)
{
if (string.IsNullOrWhiteSpace(value))
return [];
string text = value!;
List<string> tokens = new();
StringBuilder current = new();
bool inQuotes = false;
for (int i = 0; i < text.Length; i++)
{
char c = text[i];
if (c == '"')
{
if (inQuotes && i + 1 < text.Length && text[i + 1] == '"')
{
current.Append('"');
i++;
continue;
}
inQuotes = !inQuotes;
continue;
}
if (!inQuotes && char.IsWhiteSpace(c))
{
if (current.Length > 0)
{
tokens.Add(current.ToString());
current.Clear();
}
continue;
}
current.Append(c);
}
if (current.Length > 0)
tokens.Add(current.ToString());
return tokens;
}
}The patch for CmdMiddleware.cs and PowerShellMiddleware.cs (Commit 2077e5239850e83dc9cc67ae6036dcd4e68a1876) builds on this tokenization strategy. By defining the middleware target commands within an immutable argumentList array instead of compiling a flat arguments string, the operating system's command line tokenizer treats each item as a static argument, preventing any nested parameter from breaking out of its parsing boundaries.
To exploit the vulnerability, an attacker must identify an entry point where the application accepts user input and subsequently processes it through one of the affected CliInvoke.Specializations shell wrappers. This usually happens in administration portals, automation scripts, or file-processing functions where target binaries or arguments are dynamically defined. The attacker does not need any system privilege other than the ability to trigger the underlying command-execution function.
When targeting the Command Prompt wrapper (CmdProcessInvoker or UseCmd middleware), the attacker can inject a payload that closes the double quote wrapping the argument list and then appends an ampersand (&) command separator. For example, injecting the string arg" & calc.exe & " causes the library to format the command string as cmd.exe /c "target.exe arg" & calc.exe & "". The Windows command-line parser tokenizes this into multiple commands, and cmd.exe executes the malicious payload immediately after target.exe.
When targeting the PowerShell wrapper, a similar escape payload can be crafted. By supplying a target value of prog" & calc.exe & ", the generated arguments parameter resolves to pwsh.exe -NoProfile -NonInteractive -Command & "prog" & calc.exe & "". Because PowerShell treats the ampersand as the call operator or statement separator depending on context, it interprets the broken sequence as independent script blocks, triggering arbitrary code execution inside the PowerShell runtime environment.
The security impact of CVE-2026-100368 is classified as High, with a CVSS v3.1 base score of 8.4. Because the injected commands are spawned directly by the underlying .NET application process, the payload inherits the exact privilege level, security token context, and network access rights of the host application. If the host application runs with elevated service privileges (such as LocalSystem or NetworkService), the exploit results in full compromise of the hosting operating system.
Attackers can exploit this vector to perform unauthorized local operations, including reading sensitive configuration files, modifying application data, or establishing persistent backdoors. Although the vulnerability requires local placement of the exploit vector (resulting in a Local L Attack Vector score), web-facing applications that expose input forms or API endpoints that eventually invoke these shell wrappers will allow remote, unauthenticated command execution over the network.
At the time of this analysis, there are no records of this vulnerability being actively exploited in wild campaigns, nor is it listed on the CISA Known Exploited Vulnerabilities (KEV) catalog. However, because command injection vulnerabilities are highly sought after by threat actors, any systems utilizing the vulnerable libraries should be treated as high priority for patching, especially if they handle untrusted user arguments or file names.
The primary remediation strategy is upgrading all CliInvoke.Specializations packages to a patched release. For environments using the 2.10.x branch, upgrade to version 2.10.5 or later. For environments on the 2.9.x branch, upgrade to 2.9.4 or later, and for 2.8.x, upgrade to 2.8.5 or later. Pre-release applications running the 3.x alpha builds must update to version 3.0.0-beta.1 or later. Legacy installations under the package name AlastairLundy.CliInvoke.Specializations must upgrade to version 2.0.2 or later.
If immediate patching is not possible, developers should implement input validation filters to sanitize all inputs before they reach the shell wrappers. The validation logic must explicitly reject any input containing double quotes ("). For older package versions between 2.2.0 and 2.9.2, the input validation must also reject critical shell metacharacters, including semicolons (;), pipe characters (|), ampersands (&), dollar signs ($), backticks (`), and parentheses ((, )).
Additionally, security teams should evaluate the architecture to determine if the shell wrappers can be bypassed entirely. Directly invoking target binaries via ProcessStartInfo without invoking an intermediate shell interpreter like cmd.exe or powershell.exe removes the shell-parsing layer from the execution chain, eliminating the command injection threat surface entirely.
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
CliInvoke.Specializations Alastair Lundy | >= 2.2.0, <= 2.8.4 | 2.8.5 |
CliInvoke.Specializations Alastair Lundy | >= 2.9.0, <= 2.9.3 | 2.9.4 |
CliInvoke.Specializations Alastair Lundy | >= 2.10.0, <= 2.10.4 | 2.10.5 |
CliInvoke.Specializations Alastair Lundy | 3.0.0-alpha.1 - 3.0.0-alpha.10 | 3.0.0-beta.1 |
AlastairLundy.CliInvoke.Specializations Alastair Lundy | >= 1.0.0-rc.1, <= 2.0.0 | 2.0.2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-78 |
| Attack Vector | Local |
| CVSS Score | 8.4 |
| EPSS Score | N/A |
| Impact | High (Full Confidentiality, Integrity, and Availability Impact) |
| Exploit Status | poc |
| KEV Status | Not Listed |
The software constructs an OS command using externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command.
CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.
GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.
A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.
CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.
An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.
GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.