llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · setuptools

GHSA-XMJ3-9GF7-H52W

setuptools: Windows path escape via namespace_packages.txt during legacy wheel installation Description

Parche disponible
Descargar PNG JSON
CVSS
—
low
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -4 d de la divulgación
Exposición27 dDesde la divulgación, 23 oct 2026, 4:44 p. m.
Detección54 minDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Parche 84.1.0
Monitoreo
Detectada
Verificada
19 oct 26
23 oct 26
16 nov 26
19 nov 26
19 oct 26
27 oct 26
4 nov 26
12 nov 26
19 nov 26
FechaFaseEventoDetalle
Remediación Parche 84.1.0 setuptools · -4 d desde divulgación
Divulgación Publicada GHSA-XMJ3-9GF7-H52W divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Resumen generado por IA · CC-BY 4.0

This vulnerability affects setuptools, the Python packaging library, specifically its legacy wheel installation code on Windows. An attacker who supplies a malicious wheel file can cause setuptools to create an `__init__.py` file outside the intended installation directory.

Descripción del advisory
Texto original · GitHub · en inglés
Summary

On Windows, attacker-controlled content in a wheel's
`.dist-info/namespace_packages.txt` can cause setuptools' legacy wheel
installation path to create an `__init__.py` outside the requested
`destination_eggdir`.

The attacker can influence the destination path, but not the contents of
the created file.

Details

Tested setuptools commit:

`6ead555c5fb29bc57fe6105b1bffc163f56fd558`

Relevant source:

`setuptools/wheel.py`

SHA-256:

`359b7e0d5dd8c3135653abe08a8ed5dc0352eadfd7df22cb5e2b5303b7c3cafd`

The relevant call path is:

`Wheel(wheel_path).install_as_egg(destination)`
→ `_install_as_egg`
→ `_convert_metadata`
→ `_fix_namespace_packages`

A wheel can provide attacker-controlled content in:

`<distribution>.dist-info/namespace_packages.txt`

The namespace value is eventually used approximately as:

mod_dir = os.path.join(destination_eggdir, *mod.split('.'))
mod_init = os.path.join(mod_dir, '__init__.py')

If mod is a Windows drive-qualified absolute path containing no dots,
mod.split('.') preserves it as a single component.
On Windows, os.path.join(destination_eggdir, absolute_component) discards
the original base directory and resolves to the attacker-supplied absolute
path.
The existing wheel filename and ZIP traversal checks do not validate this
metadata value before it is subsequently interpreted as a filesystem path.

```markdown
### PoC

The reproduction was performed entirely inside a disposable temporary
directory.

Layout:

```text
sandbox/
    destination/
    outside/
    input/
    canary.txt

A synthetic wheel was created containing:

`demo_pkg-1.0.dist-info/namespace_packages.txt`

whose content was the absolute path of:

`sandbox\outside`

The real acquired setuptools implementation was then invoked:

setuptools.wheel.Wheel(synthetic_wheel).install_as_egg(
    sandbox_destination
)

The operation completed without exception.

Expected metadata was created under:

`sandbox\destination\EGG-INFO`

but setuptools also created:

`sandbox\outside\__init__.py`

The file did not exist before execution.

Its contents were:

__import__('pkg_resources').declare_namespace(__name__)

The unrelated canary remained byte-identical.

The sandbox was deleted after recording the evidence.
```

Impact

A crafted wheel can cause setuptools to create a fixed-content
`__init__.py` outside the intended installation directory at a
filesystem path influenced by the wheel, with the permissions of the
process performing the installation.

The demonstrated reproduction required the target parent directory to
already exist.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
setuptools≥ 38.2.2 < 84.1.0
38.2.2
84.1.0
84.2.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypisetuptools
Corregida 84.1.0 -4 d 84.2.1 no afectada
Versiones corregidas84.1.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Otrahttps://github.com/pypa/setuptools/security/advisories/GHSA-xmj3-9gf7-h52w
Otrahttps://github.com/pypa/setuptools/pull/5329
Otrahttps://github.com/pypa/setuptools/commit/6d07b8d17890dda58d944ac51e58f54af92d52af
Otrahttps://github.com/pypa/setuptools
Otrahttps://github.com/pypa/setuptools/releases/tag/v84.1.0

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.