Detect CVE-2026-113723: virtualenv Prompt Text Command Injection via bash activate Script in CrowdStrike LogScale
Detects exploitation of CVE-2026-113723, an OS command injection vulnerability (CWE-78) in the pypa/virtualenv tool affecting versions >= 20.0.0 and < 21.14.9. When a virtual environment is created with a caller-supplied prompt string, that prompt text is embedded into the generated bash 'activate' script. An attacker who controls the prompt value (for example via the --prompt CLI flag or a project automation file that feeds attacker-influenced data into virtualenv creation) can inject shell syntax so that sourcing the activate script executes commands when the prompt is drawn. This detection surfaces virtualenv invocations with suspicious --prompt values, generated activate scripts containing shell command-substitution or metacharacter payloads, and the child process execution that results when such an activate script is sourced.
MITRE ATT&CK
- Tactic
- Execution Privilege Escalation
LogScale Detection Query
// df00tech DF00-f8328d1cdf · https://df00tech.com/detections/CVE-2026-113723 · licence: https://df00tech.com/detections/licence
#event_simpleName=ProcessRollup2
| (FileName=/virtualenv/i OR (FileName=/python/i AND CommandLine=/virtualenv/i))
| CommandLine=/--prompt/i
| CommandLine=/--prompt.*(\$\(|`|;|&&|\|\|)/
| table([@timestamp, ComputerName, UserName, FileName, CommandLine, ParentBaseFileName])
| sort(@timestamp, order=desc) CrowdStrike Falcon LogScale (CQL) query for virtualenv process executions whose --prompt argument contains shell injection syntax (CVE-2026-113723).
Data Sources
Required Tables
False Positives & Tuning
- Cosmetic prompt strings with metacharacters
- CI/CD-generated prompt names
- Authorized PoC testing
Other platforms for CVE-2026-113723
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.
- Test 1 virtualenv --prompt command substitution injection
Expected signal: Process-creation event for virtualenv with a --prompt argument containing $(...), followed by a child process (touch) spawned when the activate script is sourced.
- Test 2 virtualenv --prompt backtick injection
Expected signal: virtualenv process event with a backtick-containing --prompt argument and a subsequent id command execution on activation.
- Test 3 VIRTUAL_ENV_PROMPT environment variable injection
Expected signal: virtualenv invocation where the --prompt value contains command substitution, plus a child touch process at activation.
Response Playbook
Triage
- Extract the full --prompt value from the flagged virtualenv command line and decode any shell command-substitution ($(...), backticks) or chaining (;, &&, ||, |) it contains to determine the intended injected command.
- Identify the source of the prompt value: was it supplied via the --prompt CLI flag or a project/automation file (e.g. tox.ini, Makefile, CI config)? Trace how attacker-influenced data reached it.
- Check the installed virtualenv version on the host (`virtualenv --version` or `pip show virtualenv`) and confirm whether it is in the affected range >= 20.0.0 and < 21.14.9.
- Locate the generated activate script (typically <venv>/bin/activate) and inspect the PS1/prompt assignment lines for injected executable syntax rather than a plain quoted string.
Containment
- Delete or quarantine any virtual environment whose activate script contains injected shell syntax, and prevent it from being sourced by any shell, cron job, or CI runner.
- Upgrade virtualenv to 21.14.9 or later across affected hosts and CI images, and block creation of new environments with the vulnerable version via package pinning.
- Terminate any suspicious child processes spawned when a booby-trapped activate script was sourced and isolate the host if command execution is confirmed.
Evidence Collection
- Preserve the complete process-creation record (command line, parent process, user, timestamp) for the virtualenv invocation and any child processes that followed activation.
- Copy the malicious activate script and the full virtual environment directory for forensic analysis before deletion.
- Collect shell history, environment variable dumps (VIRTUAL_ENV_PROMPT), and the relevant CI/automation configuration files that may have carried the attacker-controlled prompt.
Escalation Criteria
- !Escalate to incident response if the injected prompt payload resulted in observed child-process execution (network callbacks, credential access, or persistence).
- !Escalate if the attacker-controlled prompt value originated from a shared CI/CD pipeline or a repository many developers clone, indicating potential supply-chain scale impact.
- !Escalate if the affected host handles sensitive data or privileged credentials given the vulnerability's high confidentiality, integrity, and availability impact.
Investigation Guide
Forensic Artifacts
- >
The generated <venv>/bin/activate script containing an unsanitized prompt assignment with shell metacharacters. - >
Process-creation telemetry for the virtualenv invocation and subsequent child processes spawned at activation time. - >
Shell history and VIRTUAL_ENV_PROMPT environment variable values captured from the affected session.
Tuning Guidance
Baseline the normal --prompt values used by your development teams and CI systems; many legitimately contain parentheses or project names. Allow-list known-good prompt patterns and CI-generated names to reduce noise, then focus alerting on command-substitution syntax ($(...), backticks) and command chaining (;, &&, ||) which have no legitimate purpose in a cosmetic shell prompt. Correlate with virtualenv version inventory to prioritise hosts still running < 21.14.9.
Hunting Queries
Hunts for child processes spawned shortly after a virtualenv activate script is sourced, where the command line contains command-substitution or network-download indicators suggesting injected prompt payload execution.
// df00tech DF00-f8328d1cdf · https://df00tech.com/detections/CVE-2026-113723 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where Timestamp > ago(90d) | where ProcessCommandLine has "activate" and InitiatingProcessCommandLine has_any ("source", ". ") | where ProcessCommandLine has_any ("$(", "`", "curl", "wget", "bash -c") | project Timestamp, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessCommandLine ``` df00tech DF00-f8328d1cdf · https://df00tech.com/detections/CVE-2026-113723 · licence: https://df00tech.com/detections/licence ```
index=* (sourcetype="linux:process") (process="*activate*" OR parent_process="*activate*") (process="*$(*" OR process="*`*" OR process="*curl*" OR process="*wget*" OR process="*bash -c*") | table _time, host, user, process, parent_process Atomic Red Team Tests
Creates a virtual environment with a --prompt value containing shell command substitution to demonstrate injection into the generated activate script.
Command
virtualenv --prompt '$(touch /tmp/cve_2026_113723_poc)' /tmp/vuln_venv && . /tmp/vuln_venv/bin/activate Cleanup
deactivate 2>/dev/null; rm -rf /tmp/vuln_venv /tmp/cve_2026_113723_poc Expected Telemetry
Process-creation event for virtualenv with a --prompt argument containing $(...), followed by a child process (touch) spawned when the activate script is sourced.
Expected Detection
The KQL/SPL rules flag the virtualenv --prompt invocation containing command-substitution syntax.
Uses backtick command substitution in the --prompt value to inject a command into the bash activate script.
Command
virtualenv --prompt '`id > /tmp/cve_2026_113723_id`' /tmp/vuln_venv2 && . /tmp/vuln_venv2/bin/activate Cleanup
deactivate 2>/dev/null; rm -rf /tmp/vuln_venv2 /tmp/cve_2026_113723_id Expected Telemetry
virtualenv process event with a backtick-containing --prompt argument and a subsequent id command execution on activation.
Expected Detection
Detection rules match the backtick metacharacter in the --prompt value.
Supplies the malicious prompt via an environment variable that is then passed to the --prompt flag, to simulate automation-driven exploitation.
Command
VIRTUAL_ENV_PROMPT='$(touch /tmp/cve_2026_113723_env)' virtualenv --prompt "$VIRTUAL_ENV_PROMPT" /tmp/vuln_venv3 && . /tmp/vuln_venv3/bin/activate Cleanup
deactivate 2>/dev/null; rm -rf /tmp/vuln_venv3 /tmp/cve_2026_113723_env Expected Telemetry
virtualenv invocation where the --prompt value contains command substitution, plus a child touch process at activation.
Expected Detection
Rules flag the command-substitution syntax passed through to the --prompt argument.