Skip to content
CVE-2026-115586 Splunk · SPL

Detect CVE-2026-115586: virtualenv bash bin/activate OS Command Injection via Attacker-Controlled --prompt Value in Splunk

Detects activity related to CVE-2026-115586, a CWE-78 OS command injection in the pypa virtualenv tool (versions >= 21.14.9 and < 21.14.13). In affected versions the bash bin/activate script copies an attacker-controlled --prompt value into PS1 without escaping dollar signs or backticks when both promptvars and POSIX mode are disabled at activation. Re-enabling promptvars, running set -o posix, or starting an interactive child bash that inherits the exported PS1 then expands the stored value and runs commands as the user who activated the environment. The --prompt value may come from project metadata the user did not write. Detection focuses on virtualenv creation by vulnerable package versions, sourcing of bin/activate scripts, and child process spawning (shell, interpreter, or network tooling) linked to an activate script. CVSS 7.1. Exploit status: public PoC available.

MITRE ATT&CK

Tactic
Execution Privilege Escalation

SPL Detection Query

Splunk (SPL)
spl
``` df00tech DF00-1029f90171 · https://df00tech.com/detections/CVE-2026-115586 · licence: https://df00tech.com/detections/licence ```
index=* (sourcetype="linux:audit" OR sourcetype="linux_secure" OR sourcetype="osquery:results" OR sourcetype="Syslog")
| eval cmd=coalesce(CommandLine, command, process)
| search cmd="*bin/activate*" OR cmd="*virtualenv*"
| eval is_activate=if(match(cmd, "(source|^\.)\s+.*bin/activate"), 1, 0)
| eval is_vuln_ver=if(match(cmd, "virtualenv.*21\.14\.(9|1[0-2])\b"), 1, 0)
| eval is_susp_child=if(match(cmd, "(/dev/tcp|base64|\beval\b|-c\s|curl\s|wget\s|\bnc\s)"), 1, 0)
| where is_activate=1 OR is_vuln_ver=1 OR (is_susp_child=1 AND like(parent_process, "%activate%"))
| table _time, host, user, parent_process, cmd, is_activate, is_vuln_ver, is_susp_child
| sort - _time
high severity medium confidence

Searches process/audit telemetry for sourcing of virtualenv activate scripts, vulnerable virtualenv version strings, and suspicious child commands descending from an activate parent.

Data Sources

Linux auditdLinux process execution logsosquery

Required Sourcetypes

linux:auditlinux_secureosquery:resultsSyslog

False Positives & Tuning

  • Developers sourcing activate then running build tooling
  • CI pipelines activating environments before test execution
  • Provisioning scripts fetching packages via curl/wget after activation

Other platforms for CVE-2026-115586


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.

  1. Test 1 Simulate vulnerable virtualenv version invocation

    Expected signal: Process execution event containing the string 'virtualenv 21.14.11'

  2. Test 2 Source an activate script with an injected command

    Expected signal: Process event for the source of bin/activate followed by a curl child process within seconds

  3. Test 3 Activate then spawn reverse-shell style child

    Expected signal: Activate source event with a child bash -c process referencing /dev/tcp


Response Playbook

Triage

  1. Identify the host and user that sourced the virtualenv bin/activate script, and capture the full command line and parent process chain.
  2. Determine the installed virtualenv version on the host (pip show virtualenv) and confirm whether it falls within the affected range >= 21.14.9 and < 21.14.13.
  3. Inspect the bin/activate script and the VIRTUAL_ENV_PROMPT value (and pyvenv.cfg) of the referenced environment for a --prompt value containing command substitution, backticks, or a backslash to confirm whether a malicious prompt was stored.
  4. Correlate the timestamp with any suspicious child processes (shells, interpreters, curl/wget, netcat) spawned within seconds of activation or of a later prompt redraw.

Containment

  1. Isolate the affected host from the network if a suspicious child process (reverse shell, network beacon) is confirmed.
  2. Quarantine or delete the affected virtual environment directory and revoke any credentials that may have been exposed in the developer session.

Evidence Collection

  1. Preserve the full bin/activate script, the pyvenv.cfg, the virtualenv directory, and shell history for the affected user.
  2. Capture process execution logs (auditd/EDR) for the parent activate process and all descendants, including command lines and network connections.

Escalation Criteria

  • !Escalate to incident response if a malicious --prompt value executed, or if outbound C2 / reverse-shell activity is observed.
  • !Escalate if the affected account has elevated privileges or access to source repositories / build infrastructure, indicating potential supply-chain impact.

Investigation Guide

Forensic Artifacts

  • >The bin/activate bash script and the stored VIRTUAL_ENV_PROMPT value within the virtual environment directory
  • >Shell history (~/.bash_history) showing the source/activation command
  • >auditd/EDR process ancestry records linking activation to child command execution

Tuning Guidance

Baseline the normal developer and CI activation patterns on build/dev hosts, then suppress known-good post-activation commands (pip, python test runners, build tools). Prioritize alerts where the activate parent spawns network utilities or decodes/eval content, and where the host runs a confirmed vulnerable virtualenv version (21.14.9-21.14.12). Exclude dedicated CI runner hosts from the broad activate-sourcing signal while keeping the suspicious-child correlation enabled everywhere.


Hunting Queries

Hunts for virtualenv activate sourcing events that are closely followed by shell or network utility execution, indicating possible command injection.

Hunting — KQL
kql
// df00tech DF00-1029f90171 · https://df00tech.com/detections/CVE-2026-115586 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where ProcessCommandLine has "bin/activate" | join kind=inner (DeviceProcessEvents | where FileName in~ ("bash","sh","curl","wget","nc")) on $left.ProcessId == $right.InitiatingProcessId | project Timestamp, DeviceName, AccountName, ActivateCmd=ProcessCommandLine, ChildCmd=ProcessCommandLine1
Hunting — SPL
spl
``` df00tech DF00-1029f90171 · https://df00tech.com/detections/CVE-2026-115586 · licence: https://df00tech.com/detections/licence ```
index=* (cmd="*bin/activate*") | transaction host maxspan=30s | search cmd="*/dev/tcp*" OR cmd="*base64*" OR cmd="*curl *" | table _time host user cmd

Atomic Red Team Tests

Test 1 Simulate vulnerable virtualenv version invocation
linux

Runs a command string that reports a vulnerable virtualenv version to validate version-based detection logic.

Command

bash
echo "virtualenv 21.14.11 from /usr/lib/python3/dist-packages/virtualenv/__init__.py"

Cleanup

bash
echo 'no cleanup required'

Expected Telemetry

Process execution event containing the string 'virtualenv 21.14.11'

Expected Detection

Version-string branch of the detection matches the vulnerable range 21.14.9-21.14.12.

Test 2 Source an activate script with an injected command
linux

Creates a mock virtualenv activate script containing an injected command and sources it to simulate command injection via bin/activate.

Command

bash
mkdir -p /tmp/cve115586/bin && printf '#!/bin/bash\nVIRTUAL_ENV=/tmp/cve115586\ncurl -s http://127.0.0.1:8080/x >/dev/null 2>&1\n' > /tmp/cve115586/bin/activate && source /tmp/cve115586/bin/activate

Cleanup

bash
rm -rf /tmp/cve115586

Expected Telemetry

Process event for the source of bin/activate followed by a curl child process within seconds

Expected Detection

Activate-sourcing plus suspicious-child (curl) correlation fires.

Test 3 Activate then spawn reverse-shell style child
linux

Sources a mock activate script that launches a bash command with /dev/tcp to emulate a reverse shell injected via activation.

Command

bash
mkdir -p /tmp/cve115586b/bin && printf '#!/bin/bash\nbash -c ":>/dev/tcp/127.0.0.1/4444" 2>/dev/null\n' > /tmp/cve115586b/bin/activate && source /tmp/cve115586b/bin/activate

Cleanup

bash
rm -rf /tmp/cve115586b

Expected Telemetry

Activate source event with a child bash -c process referencing /dev/tcp

Expected Detection

Suspicious-child branch matches on /dev/tcp descending from an activate parent.

Related Detections