Security researchers at Trail of Bits discovered a significant supply chain vulnerability in the Python ecosystem originating from legacy bootstrap scripts. The flaw exposed developers using certain installation methods to a domain takeover risk, affecting multiple Python packages and tools.
The vulnerability was centered on the expired domain name pypa.io, which was hard-coded in older installation scripts. Had a malicious actor registered this domain, they could have served compromised versions of core Python packaging tools to unsuspecting developers.
Expired Domain Creates Hijacking Opportunity
The investigation revealed that older versions of the get-pip.py script, used for bootstrapping Python packaging tools like pip, setuptools, and wheel, contained hard-coded links to fetch resources over insecure HTTP from the pypa.io domain. At the time of the discovery, this domain had lapsed and was available for public registration.
This configuration created a direct path for a supply chain attack. An attacker could have acquired the pypa.io domain and configured it to distribute malicious code disguised as legitimate Python tools. Any developer or automated system running the legacy bootstrap script would have then executed this malicious code.
Proactive Mitigation and Project Impact
To prevent immediate exploitation, the Trail of Bits security team proactively registered the expired pypa.io domain. Following this defensive measure, they transferred control of the domain to the Python Packaging Authority (PyPA) to secure it for the long term.
The issue impacted not only the bootstrap scripts but also numerous documentation pages and projects that referenced the vulnerable domain. Projects found to contain links to the expired domain included ansible-runner, mkdocs, pyenv-virtualenv, and the official python-guide. The PyPA has since updated its official guidance, directing all users to the secure and correct URL at https://bootstrap.pypa.io/get-pip.py to download the installer script.