[Paper Review] I Know What You Imported Last Summer: A study of security threats in thePython ecosystem
This paper investigates critical security vulnerabilities in the Python package ecosystem (PyPI), demonstrating how attackers can exploit install-time code execution, impersonate popular packages, and cause widespread license violations through transitive dependencies. It reveals that 0.78% of packages execute code during installation, 14 packages are implicitly trusted on average per install, and over 1,500 license violations exist due to incompatible dependencies, highlighting systemic risks in package trust and licensing.
The popularity of Python has risen rapidly over the past 15 years. It is a major language in some of the most exciting technologies today. This popularity has led to a large ecosystem of third-party packages available via the pip package registry which hosts more than 200,000 packages. These third-party packages can be reused by simply importing the package after installing using package managers like pip. The ease of reuse of third-party software comes with security risks putting millions of users in danger. In this project, we study the ecosystem to analyze this threat. The mature ecosystem of Python has multiple weak spots that we highlight in our project. First, we demonstrate how trivial it is to exploit the Python ecosystem. Then, we systematically analyze dependencies amongst packages, maintainers, and publicly reported security issues. Most attacks are possible only if users install malicious packages. We thus try to analyze and evaluate different methods used by attackers to force incorrect downloads. We quantify your ideas by estimating the potential threat that can be caused by exploiting a popular Python package. We also discuss methods used in the industry to defend against such attacks
Motivation & Objective
- To analyze the security risks in the Python package ecosystem (PyPI), particularly those arising from third-party package reuse.
- To investigate how attackers can exploit package installation processes to achieve privilege escalation or execute malicious code.
- To quantify the impact of package impersonation and typosquatting attacks on user trust and system security.
- To identify and analyze open-source license violations caused by incompatible transitive dependencies in PyPI packages.
- To evaluate existing defenses and propose practical improvements for securing the Python ecosystem.
Proposed method
- Collected and analyzed metadata from 206,296 PyPI packages, 1.5 million releases, and 387,867 maintainers to construct a dependency graph.
- Tracked package installation behavior by identifying packages that execute code during setup, including imports and function calls at install time.
- Measured implicit trust by computing the average number of packages and maintainers a given package implicitly trusts during installation.
- Analyzed package names and typos to detect impersonation and typo-squatting attacks, including defensive impersonation by benevolent developers.
- Evaluated license compatibility by comparing license types of imported packages, identifying violations when permissive-licensed packages import restrictive-licensed dependencies.
- Used real-world examples (e.g., SSH key theft, Bitcoin mining) and case studies (e.g., Cisco Genie) to validate exploit feasibility and impact.
Experimental results
Research questions
- RQ1How prevalent are install-time code execution vulnerabilities in PyPI packages, and what is their potential for privilege escalation?
- RQ2What is the average level of implicit trust in the PyPI ecosystem, and how has it evolved over time?
- RQ3How common are package impersonation and typo-squatting attacks, and what defensive practices are emerging?
- RQ4What is the scale of open-source license violations due to transitive dependencies in the Python ecosystem?
- RQ5What technical and policy-level defenses can mitigate these threats in practice?
Key findings
- 0.28% of packages in the study execute functions other than setup() during installation, and 0.78% import other packages at install time, indicating a significant attack surface for privilege escalation.
- On average, a Python package implicitly trusts 14 other packages during installation, and the top 10,000 packages reach an average of 247 packages, indicating high transitive trust.
- The average maintainer reaches 338 packages, and maintainers' reach has been increasing over time, amplifying the impact of hijacked accounts.
- The study identified 672 potential license violations involving MIT-licensed packages importing GPLv3-licensed dependencies, and 832 involving LGPLv3, highlighting widespread compliance risks.
- The top 20 packages responsible for the most license violations include those with restrictive licenses that are being imported by permissively licensed packages, creating cascading compliance issues.
- A real-world case study of Cisco’s Genie framework showed that a permissively licensed package inherits the restrictive license of its dependency (restview), propagating the violation to all downstream users.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.