{"id":2611,"cve":"CVE-2026-113723","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2026-113723\/","cwe":"CWE-78","cwe_number":78,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/78","cvss_score":7.1,"published":"2026-10-20","owasp":"A03 Injection","odc":"Checking","cdc":"Missing Check","category":"Input Validation and Sanitization","subcategory":"Command Injection","scope":"Local","impact":"Arbitrary Code Execution","summary":"Bash injection via crafted virtualenv prompt before activation (fixed in 21.14.9).","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2026-113723\/","description":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, caller-supplied prompt text can become executable syntax in the bash activation prompt. An attacker must influence the value passed to virtualenv, and a user must subsequently activate the environment and draw the prompt. This vulnerability is fixed in 21.14.9.","solution":"Upgrade virtualenv to version\u202f21.14.9\u202for later.","affected_component":"virtualenv","fixed_by_upgrading":true,"vulnerable_code":"import os\nimport subprocess\n\ndef create_virtualenv(path: str, prompt: str):\n    \"\"\"\n    Create a virtualenv at ``path`` and write a Bash activation script\n    that sets the prompt using the user\u2011supplied ``prompt``.\n    \"\"\"\n    # Create the directory structure (simplified)\n    os.makedirs(os.path.join(path, \"bin\"), exist_ok=True)\n\n    # VULNERABLE: user\u2011controlled prompt is interpolated into Bash code without sanitization\n    activate_script = f\"\"\"#!\/usr\/bin\/env bash\n# This file is generated by virtualenv\nVIRTUAL_ENV=\"{path}\"\nexport VIRTUAL_ENV\n# Set prompt\nexport PS1=\"({prompt}) $PS1\"\n\"\"\"\n\n    activate_path = os.path.join(path, \"bin\", \"activate\")\n    with open(activate_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(activate_script)\n    os.chmod(activate_path, 0o755)\n\n    # Simulate virtualenv's post\u2011creation steps\n    subprocess.run([activate_path], shell=True, check=False)\n","patched_code":"import os\nimport subprocess\nimport shlex\n\ndef create_virtualenv(path: str, prompt: str):\n    \"\"\"\n    Create a virtualenv at ``path`` and write a Bash activation script\n    that sets the prompt using the user\u2011supplied ``prompt``.\n    \"\"\"\n    # Create the directory structure (simplified)\n    os.makedirs(os.path.join(path, \"bin\"), exist_ok=True)\n\n    # FIX: escape the prompt to prevent injection in the generated Bash code\n    safe_prompt = shlex.quote(prompt)\n    activate_script = f\"\"\"#!\/usr\/bin\/env bash\n# This file is generated by virtualenv\nVIRTUAL_ENV=\"{path}\"\nexport VIRTUAL_ENV\n# Set prompt\nexport PS1=({safe_prompt})\\\\ $PS1\n\"\"\"\n\n    activate_path = os.path.join(path, \"bin\", \"activate\")\n    with open(activate_path, \"w\", encoding=\"utf-8\") as f:\n        f.write(activate_script)\n    os.chmod(activate_path, 0o755)\n\n    # Simulate virtualenv's post\u2011creation steps\n    subprocess.run([activate_path], shell=True, check=False)\n","payload_needed":true,"payload":null,"payload_status":"model_refused","published_fix":[],"references":null}