Intel

AIKIDO-2026-674766

virtualenv is vulnerable to OS Command Injection

OS Command InjectionGHSA-p58f-9548-mpm2 Published 2 days ago

78

High Risk

This Affects:

PYTHONvirtualenv
0.8.0 - 21.7.12
Fixed in 21.7.13
Are you affected? Scan for Free

TL;DR

The generated bash activate script and activate.fish script interpolate a shlex.quote-ed path into a position that is quoted a second time, so the extra quotes terminate early and leave part of the value parsed as shell code. In activate, this triggers on the branch that reports a relocated virtual environment, so a virtual environment path containing $(...), backticks, or ; runs commands when a user sources the script. In activate.fish, the same double quoting around the TCL_LIBRARY and TK_LIBRARY paths lets a parenthesized command substitution in the interpreter's library path execute on source. The fix moves the placeholders outside the surrounding quotes so each value keeps only its original shlex.quote quoting.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you source a bash or fish activate script for a virtual environment whose path, or whose interpreter's Tcl/Tk library path, can contain untrusted shell metacharacters.

Background info

virtualenv is vulnerable to OS Command Injection in versions 0.8.0 - 21.7.12.

How to fix this

Upgrade the virtualenv library to the patch version.

Are You Affected?

Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.

Free. No credit card required.

Aikido Platform