setuptools path escape via namespace_packages.txt on Windows

Severity: medium · CVSS 4 · Published 2026-10-23

setuptools is a Python library that manages package installation and distribution. On Windows systems, a malicious wheel package could cause setuptools to create files outside the intended installation directory during legacy wheel installation. An attacker could place an __init__.py file in an arbitrary location on the filesystem where the parent directory exists, potentially affecting system integrity or enabling privilege escalation depending on file permissions.

Technologies: setuptools (PyPI), Python Packaging Authority Setuptools. Vendors: PyPI, Python Packaging Authority.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Medium severity, with a CVSS score of 4, published 23 October 2026.
Which products and versions are affected?
setuptools (PyPI) >= 38.2.2, < 84.1.0, ECOSYSTEM:introduced=38.2.2,fixed=84.1.0; Python Packaging Authority Setuptools >= 38.2.2, < 84.1.0.
Is there a fix for This vulnerability?
Yes. setuptools (PyPI): upgrade to 84.1.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is in a software library.
Am I affected?
Check whether you run setuptools (PyPI) or Python Packaging Authority Setuptools at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • setuptools (PyPI): upgrade to 84.1.0 or later
    pip install "setuptools>=84.1.0"

Technical details

The vulnerability exists in setuptools' legacy wheel installation path (_fix_namespace_packages) on Windows. Attacker-controlled content in a wheel's .dist-info/namespace_packages.txt is split on dots and passed directly to os.path.join(); if a namespace entry is an absolute Windows path with no dots, it remains a single component, and os.path.join() then discards the base directory and resolves to the attacker-supplied absolute path. The vulnerability requires local access to install the malicious wheel, existing parent directories at the target location, and cannot write arbitrary content (only fixed __init__.py with namespace declaration).

Affected products

  • Python Packaging Authority setuptools >= 38.2.2, < 84.1.0

Timeline

  • 2026-10-19: disclosed
  • 2026-10-19: patched: Fix released in version 84.1.0

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.