Categories
CVE-2026-102938

Vulnerability in virtualenv (CVE-2026-102938)

Summary

Vulnerability in virtualenv (CVE-2026-102938). Risk of unauthorized operations or information disclosure. Exploitable via pyvenv.cfg. Mitigation: upgrade to 21.7.11 or later.

Original description

The description as published by the source.

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.

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. 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.

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.

Fixed in 21.7.11: PyEnvCfg.write() now collapses those boundaries to spaces
as it serializes each line, so it cannot…

Source: NIST National Vulnerability Database NVD GitHub Advisory

Auto-generated summary

Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.

A vulnerability tracked as CVE-2026-102938 has been found in virtualenv.
Attackers can target a specific entry point like pyvenv.cfg over the network to misuse the product.
Risk of unauthorized operations or information disclosure.
What to do: upgrade virtualenv to 21.7.11 or later.
If unsure, ask your IT team or search "virtualenv CVE-2026-102938" on the vendor's site.

CVE-2026-102938 (virtualenv) — CWE-93
Attack surface: pyvenv.cfg / prompt / VIRTUALENV_PROMPT / home
Patched: 21.7.11 — apply immediately
Workaround: Do not pass externally influenced data as the virtualenv prompt.
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.

❓ What is the problem

A vulnerability (CWE-93) exists in virtualenv. Attackers reach the vulnerable code path via pyvenv.cfg.

📍 Affected scope

Check the vendor advisory for the affected versions of virtualenv. Attack surface: pyvenv.cfg / prompt / VIRTUALENV_PROMPT / home.

🔥 Severity

Severity: ?. Risk of unauthorized operations or information disclosure.

🔧 How to fix

Update to 21.7.11.

🛡️ Workaround

Workaround: Do not pass externally influenced data as the virtualenv prompt.

🔍 Detection

Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'virtualenv' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.

Response actions

Concrete steps and command examples for SOC/SRE teams to execute in order

  1. 1
    Identify exposure identify
    grep -r 'virtualenv' . | grep -v node_modules

    リポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で virtualenv を grep し、稼働しているサービス・バージョンを把握する。

  2. 2
    Apply temporary workaround mitigate
    Do not pass externally influenced data as the virtualenv prompt.

    パッチが適用されるまでの応急処置として、Do not pass externally influenced data as the virtualenv prompt. を実施。回避策の副作用 (機能低下) を確認した上で。

  3. 3
    Apply patch patch
    Upgrade virtualenv to 21.7.11

    ステージング環境で 21.7.11 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。

  4. 4
    Post-deployment verification verify
    Confirm patched version is live in production

    パッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。

Affected packages

pip virtualenv
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"21.7.11"}]}]
Bitnami virtualenv
[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"21.7.11"}]}]
PyPI virtualenv
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"21.7.11"}]}]

Fix status by distribution

Fixed packages published by each distribution for this CVE

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details