Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍 PyPI
Not in CISA KEV

virtualenv writes prompt values into pyvenv.cfg without sanitizing line boundaries, allowing configuration injectionGHSA-9h9j-4vrj-gf7g

Fix: pypa/virtualenv#3247

GHSA-9h9j-4vrj-gf7g is a CWE-93 vulnerability in virtualenv. A fix is available for virtualenv — see the affected versions and patch details below.

Also known asBIT-virtualenv-2026-102938CVE-2026-102938PYSEC-2026-4012
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Oct 22, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for GHSA-9h9j-4vrj-gf7g.

EPSS Exploitation Probability

via FIRST.org ↗
0.1%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs3th percentile — riskier than 3% of all scored CVEsHighest risk
0.00%0.21%0.43%0.64%0.1%0.1%Oct 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

Real-World Exposure

1 pkg affected
🐍virtualenv

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Summary

pyvenv.cfg is a line-based format with no escape syntax. PyEnvCfg.write() wrote values verbatim, while PyEnvCfg._read_values() parses the file with str.splitlines(). A value containing a line boundary therefore became additional configuration lines, and because reading is last-wins, the injected keys replaced any key written earlier in the file.

Impact

The prompt value is the reachable input: it is set by --prompt, by the VIRTUALENV_PROMPT environment variable, or from the config file, and write() emits prompt before home. A crafted prompt can therefore set home in the generated pyvenv.cfg:

$ virtualenv --prompt $'x"\nhome = /attacker/path\nprompt = "z' venv
$ grep '^home' venv/pyvenv.cfg
home = /attacker/path

home is what tooling reads to locate the base interpreter, so a consumer that trusts it can be pointed elsewhere. implementation, version_info, version, executable, command and virtualenv are also written before prompt and can be replaced the same way.

This requires the prompt to come from somewhere other than the person running the command, for example a CI job templating a branch name into it, tooling deriving an environment name from user-supplied data, or an inherited VIRTUALENV_PROMPT. Where the operator supplies the prompt directly they already control the command line, and the effect is corruption rather than privilege gain: the value is truncated at the boundary and read back with a dangling quote.

Details

The boundary set is the one str.splitlines() recognizes, which is wider than \n: \r, \v, \f, the file, group and record separators, U+0085, U+2028 and U+2029 were all written through unchanged and all split the line when read back.

Patches

PyEnvCfg.write() now collapses those boundaries to spaces as it serializes each line, so it cannot emit a structurally invalid file regardless of what a caller places in content.

Workarounds

Do not pass externally influenced data as the virtualenv prompt. Strip line boundaries from any value before using it as --prompt or VIRTUALENV_PROMPT.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIvirtualenvall versions21.7.11pip install --upgrade 'virtualenv==21.7.11'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for virtualenv, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update virtualenv to 21.7.11 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-9h9j-4vrj-gf7g is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate

A flaw was found in virtualenv, a tool for creating isolated Python virtual environments that is bundled in a number of Red Hat offerings, including Red Hat Enterprise Linux, Red Hat OpenShift AI, and other layered products and containers, as well as in Fedora and EPEL community builds. Red Hat rates this flaw as…

Workaround published by Red Hat
Strip line boundaries (such as newline, carriage return, and other Unicode line-separator characters) from any value before using it as --prompt or VIRTUALENV_PROMPT, and do not pass externally influenced data -- for example user-supplied strings or CI-derived values such as branch names -- as the virtualenv prompt. Ensure the VIRTUALENV_PROMPT environment variable and any configuration file that sets the prompt are sourced only from trusted input. The upstream project fixed this issue in virtualenv 21.7.11 by collapsing line boundaries when writing pyvenv.cfg, so updating to a version that contains this fix resolves the issue. For Red Hat products that bundle virtualenv, apply updates…
Source: Red Hat security advisory for GHSA-9h9j-4vrj-gf7g (CC BY 4.0)
ProductFixed inAdvisory
Red Hat Ansible Automation Platform 2.6ansible-automation-platform-26/eda-controller-rhel9:1791945282RHSA-2026:87120
Red Hat Ansible Automation Platform 2.7ansible-automation-platform-27/eda-controller-rhel9:1792141010RHSA-2026:87124
Red Hat OpenShift AI 2.25rhoai/odh-feature-server-rhel9:1792148523RHSA-2026:87410
Red Hat OpenShift AI 3.4rhoai/odh-feature-server-rhel9:1791863220RHSA-2026:84734
Red Hat OpenShift AI 3.5rhoai/odh-ta-lmes-job-rhel9:1792501995RHSA-2026:86891

Frequently Asked Questions

### Summary `pyvenv.cfg` is a line-based format with no escape syntax. `PyEnvCfg.write()` wrote values verbatim, while `PyEnvCfg._read_values()` parses the file with `str.splitlines()`. A value containing a line boundary therefore became additional configuration lines, and because reading is last-wins, the injected keys replaced any key written earlier in the file. ### Impact The `prompt` value is the reachable input: it is set by `--prompt`, by the `VIRTUALENV_PROMPT` environment variable, or from the config file, and `write()` emits `prompt` before `home`. A crafted prompt can therefore s
O3 Security · Impact-Aware SCA

Is GHSA-9h9j-4vrj-gf7g in your dependencies?

Find it across PyPI, including transitive dependencies.

GHSA-9h9j-4vrj-gf7g: virtualenv — Fixed in 21.7.11