PYSEC-2026-4013: virtualenv bash and fish activation scripts execute commands embedded in paths

Published Sep 29, 2026
·
Updated

virtualenv is a tool for creating isolated virtual python environments. Prior to 21.7.13, the generated activate (bash and zsh) and activate.fish scripts place values already escaped by shlex.quote inside an additional quoted context. In the bash and zsh script, a crafted virtual environment path reaches VIRTUALENV when a relocated environment's recorded directory is absent; in the fish script, crafted Tcl or Tk library paths reach TCLLIBRARY or TKLIBRARY. The surplus quotes can terminate the data-only quoted run and leave shell metacharacters parsed as commands when a user sources the activation script, allowing code execution with that user's privileges. This issue is fixed in version 21.7.13.

Affected Software

2 affected componentsFixes available
pypi/virtualenv<21.7.13
bitnami/virtualenv<21.7.13
21.7.13

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade bitnami/virtualenv to a version that resolves this vulnerability.

    Fixed in 21.7.13
  2. Upgrade

    Upgrade virtualenv to a version that resolves this vulnerability.

    Fixed in 21.7.13

Event History

Sep 29, 2026
CVE Published
via OSV·08:50 PM
Data Sourced
via OSV·08:50 PM
DescriptionSeverityWeakness
Oct 6, 2026
Advisory Published
via OSV·11:57 AM
Data Sourced
via OSV·11:57 AM
Affected Software

Frequently Asked Questions

1

Who is exposed to this issue?

Users who source activation scripts generated by virtualenv before 21.7.13 are exposed when those scripts contain attacker-crafted path values. Bash and zsh are affected through a relocated environment whose recorded directory is absent; fish is affected through crafted Tcl or Tk library paths.

2

What must an attacker do to achieve code execution?

The attacker must cause crafted path data containing shell metacharacters to be embedded in the generated activation script, then persuade or cause a user to source that script. Commands run with the privileges of the user activating the environment.

3

Are all activation scenarios affected?

No. The described bash and zsh path requires a relocated environment and an absent recorded directory. The fish case depends on crafted Tcl or Tk library paths being written into the activation script.

4

What version fixes the issue?

Upgrade virtualenv to version 21.7.13 or later. The issue is fixed in 21.7.13.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203