{"vuln_id":"CVE-2026-113732","aliases":["GHSA-c947-3pg5-gm8q","GHSA-p58f-9548-mpm2"],"description":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX shlex.quote() even though fish interprets backslashes and single quotes differently. An attacker-influenced environment path, --prompt, or VIRTUALENV_PROMPT value containing a backslash before a quote can therefore terminate the generated fish literal and execute command substitution when the user sources activate.fish. This issue is fixed in version 21.14.2.","published_at":"2026-10-20T22:19:30.413000Z","modified_at":"2026-11-21T19:00:06.840592Z","first_seen_at":"2026-11-21T19:15:47.234655Z","severity":"high","severity_source":"nvd","cvss_score":7.8,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","cwe":["CWE-78","CWE-116"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.0026,"epss_percentile":0.17875,"nvd_status":"Analyzed","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-113732"},"matched_alias":null,"items":[{"id":10771,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-c947-3pg5-gm8q: virtualenv activate.fish runs commands from a path or prompt with a backslash before a quote","summary":"virtualenv activate.fish runs commands from a path or prompt with a backslash before a quote\n\n### Impact\n\n`FishActivator` defines no `quote()`, so it inherits `ViaTemplateActivator.quote`, which returns `shlex.quote(string)`. That function follows POSIX `sh` rules, where a backslash inside single quotes stays a literal character. fish reads `\\'` inside single quotes as an escaped quote and `\\\\` as an escaped backslash. A value with a backslash before a quote therefore ends the literal somewhere other than where `shlex.quote` put the end, and fish expands the command substitution that follows.\n\nThe environment path reaches `set -gx VIRTUAL_ENV`, and `--prompt` or `VIRTUALENV_PROMPT` reaches `set -gx VIRTUAL_ENV_PROMPT`. For `--prompt \"x\\'\\$(touch PWNED)'\\'\"`, the generated `activate.fish` contains:\n\n```fish\nset -gx VIRTUAL_ENV_PROMPT 'x\\'\"'\"'$(touch PWNED)'\"'\"'\\'\"'\"''\n```\n\n`source bin/activate.fish` runs `touch PWNED`, and fish prints no error. The same payload as a directory name runs through `VIRTUAL_ENV`. `--prompt .` takes the current directory's name, so running virtualenv inside a directory someone else named is enough. Without the backslash the payload runs nothing, and under bash it runs nothing either.\n\nvirtualenv generates `activate.fish` by default. An attacker needs to influence the environment path or prompt: a CI job or wrapper tool that passes a branch, project or job name through, or a directory in a cloned repository or unpacked archive.\n\nThe bug affects every release up to 21.14.1 that ships `activate.fish`. The GHSA-p58f-9548-mpm2 fix in 21.7.13 moved the placeholders outside their quotes but kept `shlex.quote`.\n\n### Patches\n\nFixed in 21.14.2. `activate.fish` now escapes backslashes and single quotes the way fish reads them, so the example above runs nothing and shows the prompt as given. Fix: https://github.com/pypa/virtualenv/commit/3bddeaf8d02c3ee7f576503efb082f8f494cfcab\n\n### Workarounds\n\nDo not create an environment whose path or prompt contains a backslash, and inspect `activate.fish` before you source one you did not create.\n\n### Credits\n\nKevin Stubbings (@Kwstubbs) of GitHub Security Lab reported this issue.\n\nAffected: PyPI:virtualenv\n\nFixed in: 21.14.2\n\nReferences:\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-c947-3pg5-gm8q\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-113732\nhttps://github.com/pypa/virtualenv/commit/3bddeaf8d02c3ee7f576503efb082f8f494cfcab\nhttps://github.com/pypa/virtualenv\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.2","url":"https://osv.dev/vulnerability/GHSA-c947-3pg5-gm8q","published_at":"2026-10-21T16:39:58Z","updated_at":"2026-11-18T12:10:36.233350Z","fetched_at":"2026-11-21T19:15:55.946164Z","severity":"high","cvss_score":7.8,"epss":0.0026,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"virtualenv","vuln_id":"CVE-2026-113732","vuln_ids":["CVE-2026-113732","BIT-VIRTUALENV-2026-113732","GHSA-C947-3PG5-GM8Q","GHSA-P58F-9548-MPM2","PYSEC-2026-4386"],"tags":["osv","pypi","fix-available"],"cluster_id":4256,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10771","html":"https://vulnwatch.ve1ve2.com/item/10771"}},{"id":11342,"source":{"id":"osv","name":"OSV.dev"},"title":"DEBIAN-CVE-2026-113732: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX shlex.quote() even though fish interprets backslashes and single quotes differently. An attacker-influenced environment path, --prompt, or VIRTUALENV_PROMPT value containing a backslash before a quote can therefore terminate the generated fish literal and execute command substitution when the user sources activate.fish. This issue is fixed in version 21.14.2.\n\nAffected: Debian:12:python-virtualenv, Debian:13:python-virtualenv, Debian:14:python-virtualenv\n\nFixed in: 21.15.6+ds-1\n\nReferences:\nhttps://security-tracker.debian.org/tracker/CVE-2026-113732","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-113732","published_at":"2026-10-20T22:19:30.413000Z","updated_at":"2026-11-21T19:00:06.840592Z","fetched_at":"2026-11-21T19:23:21.853716Z","severity":"high","cvss_score":7.8,"epss":0.0026,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"debian","product":"12:python-virtualenv","vuln_id":"CVE-2026-113732","vuln_ids":["CVE-2026-113732","DEBIAN-CVE-2026-113732","GHSA-C947-3PG5-GM8Q","GHSA-P58F-9548-MPM2"],"tags":["osv","debian","fix-available"],"cluster_id":4255,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11342","html":"https://vulnwatch.ve1ve2.com/item/11342"}},{"id":10772,"source":{"id":"osv","name":"OSV.dev"},"title":"PYSEC-2026-4386: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX shlex.quote() even though fish interprets backslashes and single quotes differently. An attacker-influenced environment path, --prompt, or VIRTUALENV_PROMPT value containing a backslash before a quote can therefore terminate the generated fish literal and execute command substitution when the user sources activate.fish. This issue is fixed in version 21.14.2.\n\nAffected: PyPI:virtualenv\n\nFixed in: 21.14.2\n\nReferences:\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.2\nhttps://github.com/pypa/virtualenv/commit/3bddeaf8d02c3ee7f576503efb082f8f494cfcab\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-c947-3pg5-gm8q","url":"https://osv.dev/vulnerability/PYSEC-2026-4386","published_at":"2026-10-20T22:19:30.413000Z","updated_at":"2026-11-18T12:10:36.233350Z","fetched_at":"2026-11-21T19:15:55.946165Z","severity":"high","cvss_score":7.8,"epss":0.0026,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"virtualenv","vuln_id":"CVE-2026-113732","vuln_ids":["CVE-2026-113732","BIT-VIRTUALENV-2026-113732","GHSA-C947-3PG5-GM8Q","GHSA-P58F-9548-MPM2","PYSEC-2026-4386"],"tags":["osv","pypi","fix-available"],"cluster_id":4255,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10772","html":"https://vulnwatch.ve1ve2.com/item/10772"}},{"id":3910,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-113732: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.2, FishActivator inherits ViaTemplateActivator.quote(), which uses POSIX shlex.quote() even though fish interprets backslashes and single quotes differently. An attacker-influenced environment path, --prompt, or VIRTUALENV_PROMPT value containing a backslash before a quote can therefore terminate the generated fish literal and execute command substitution when the user sources activate.fish. This issue is fixed in version 21.14.2.\n\nReferences:\nhttps://github.com/pypa/virtualenv/commit/3bddeaf8d02c3ee7f576503efb082f8f494cfcab\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.2\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-c947-3pg5-gm8q","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-113732","published_at":"2026-10-20T22:19:30.413000Z","updated_at":"2026-11-17T15:16:26.490000Z","fetched_at":"2026-11-21T19:15:31.479406Z","severity":"high","cvss_score":7.8,"epss":0.0026,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-113732","vuln_ids":["CVE-2026-113732","GHSA-C947-3PG5-GM8Q","GHSA-P58F-9548-MPM2"],"tags":["CWE-78","CWE-116"],"cluster_id":4255,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/3910","html":"https://vulnwatch.ve1ve2.com/item/3910"}}]}