Skip to content
CVE-2026-115586 IBM QRadar · QRadar

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

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

QRadar Detection Query

IBM QRadar (QRadar)
sql
-- df00tech DF00-1029f90171 · https://df00tech.com/detections/CVE-2026-115586 · licence: https://df00tech.com/detections/licence
SELECT QIDNAME(qid) AS event, "sourceip", username, "Process CommandLine" AS cmd, "Parent Process Name" AS parent, starttime
FROM events
WHERE LOGSOURCETYPENAME(devicetype) ILIKE '%linux%'
AND (
  "Process CommandLine" IMATCHES '.*(source|\.)\s+.*bin/activate.*'
  OR "Process CommandLine" IMATCHES '.*virtualenv.*21\.14\.(9|1[0-2]).*'
  OR ("Parent Process Name" ILIKE '%activate%' AND "Process CommandLine" IMATCHES '.*(/dev/tcp|base64|eval|curl|wget| nc ).*')
)
ORDER BY starttime DESC LAST 7 DAYS
high severity medium confidence

Returns Linux process events showing virtualenv activate sourcing, vulnerable version strings, or suspicious children of an activate parent.

Data Sources

Linux OS process events

Required Tables

events

False Positives & Tuning

  • Developer build/test commands after activation
  • CI/CD automation sourcing activate before interpreters run
  • Dependency download via curl/wget during provisioning

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