An Empirical Study of Malicious Code In PyPI Ecosystem
Not on the map. Why?
Abstract (arXiv)
PyPI provides a convenient and accessible package management platform to developers, enabling them to quickly implement specific functions and improve work efficiency. However, the rapid development of the PyPI ecosystem has led to a severe problem of malicious package propagation. Malicious developers disguise malicious packages as normal, posing a significant security risk to end-users. To this end, we conducted an empirical study to understand the characteristics and current state of the malicious code lifecycle in the PyPI ecosystem. We first built an automated data collection framework and collated a multi-source malicious code dataset containing 4,669 malicious package files. We preliminarily classified these malicious code into five categories based on malicious behaviour characteristics. Our research found that over 50% of malicious code exhibits multiple malicious behaviours, with information stealing and command execution being particularly prevalent. In addition, we observed several novel attack vectors and anti-detection techniques. Our analysis revealed that 74.81% of all malicious packages successfully entered end-user projects through source code installation, thereby increasing security risks. A real-world investigation showed that many reported malicious packages persist in PyPI mirror servers globally, with over 72% remaining for an extended period after being discovered. Finally, we sketched a portrait of the malicious code lifecycle in the PyPI ecosystem, effectively reflecting the characteristics of malicious code at different stages. We also present some suggested mitigations to improve the security of the Python open-source ecosystem.
Key facts. Cited by 19 papers in the map (data through 13 Oct 2026). First posted on arXiv 20 Sep 2023.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2024: 1; 2025: 6; 2026: 12.
19 papers.
Sort:
By area:
- 2026"Do Not Mention This to the User": Detecting and Understanding Malicious Agent Skills in the Wildcited by 48
- 2024Leveraging Large Language Models to Detect npm Malicious Packagescited by 6
- 2026ClawHub Security Signals: When VirusTotal, Static Analysis, and SkillSpector Disagreecited by 5
- 2025Detecting Malicious Source Code in PyPI Packages with LLMs: Does RAG Come in Handy?cited by 3
- 2025Automatically Generating Rules of Malicious Software Packages via Large Language Modelcited by 2
- 2025AutoMalDesc: Large-Scale Script Analysis for Cyber Threat Researchcited by 1
- 2025Casting a SPELL: Sentence Pairing Exploration for LLM Limitation-breakingcited by 1
- 2026Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packagescited by 1
- 2026Setup Complete, Now You Are Compromised: Weaponizing Setup Instructions Against AI Coding Agentscited by 1
- 2026Broken on Arrival: Silently Defective LLM Artifacts in Public Model Registries and How to Catch Themcited by 1
- 2025Leveraging Code Cohesion Analysis to Identify Source Code Supply Chain Attackscited by 0
- 2025One Detector Fits All: Robust and Adaptive Detection of Malicious Packages from PyPI to Enterprisescited by 0
7 more
- 2026CHASE: LLM Agents for Dissecting Malicious PyPI Packagescited by 0
- 2026One RNG to Rule Them All: How Randomness Becomes an Attack Vector in Machine Learningcited by 0
- 2026eDySec: A Deep Learning-based Explainable Dynamic Analysis Framework for Detecting Malicious Packages in PyPI Ecosystemcited by 0
- 2026LCC-LLM: Leveraging Code-Centric Large Language Models for Malware Attributioncited by 0
- 2026LLM-Enhanced Hierarchical Heterogeneous Graph Representation Learning for Malicious Python Package Detectioncited by 0
- 2026Which Neurons Detect Malicious Code? A Probing Study of LLM Security Knowledgecited by 0
- 2026From Adoption to Deployment: A Qualitative Study on AI Integration in Software Development Practicecited by 0
- 2026Broken on Arrival: Silently Defective LLM Artifacts in Public Model Registries and How to Catch Them5 Sep 2026
- 2026From Adoption to Deployment: A Qualitative Study on AI Integration in Software Development Practice18 Jul 2026
- 2026Setup Complete, Now You Are Compromised: Weaponizing Setup Instructions Against AI Coding Agents16 Jul 2026
- 2026Which Neurons Detect Malicious Code? A Probing Study of LLM Security Knowledge11 Jul 2026
- 2026LLM-Enhanced Hierarchical Heterogeneous Graph Representation Learning for Malicious Python Package Detection3 Jul 2026
- 2026ClawHub Security Signals: When VirusTotal, Static Analysis, and SkillSpector Disagree31 May 2026
- 2026LCC-LLM: Leveraging Code-Centric Large Language Models for Malware Attribution7 May 2026
- 2026eDySec: A Deep Learning-based Explainable Dynamic Analysis Framework for Detecting Malicious Packages in PyPI Ecosystem29 Apr 2026
- 2026One RNG to Rule Them All: How Randomness Becomes an Attack Vector in Machine Learning9 Feb 2026
- 2026"Do Not Mention This to the User": Detecting and Understanding Malicious Agent Skills in the Wild6 Feb 2026
- 2026Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packages17 Jan 2026
- 2026CHASE: LLM Agents for Dissecting Malicious PyPI Packages11 Jan 2026
7 more
- 2025Casting a SPELL: Sentence Pairing Exploration for LLM Limitation-breaking24 Dec 2025
- 2025One Detector Fits All: Robust and Adaptive Detection of Malicious Packages from PyPI to Enterprises3 Dec 2025
- 2025AutoMalDesc: Large-Scale Script Analysis for Cyber Threat Research17 Nov 2025
- 2025Leveraging Code Cohesion Analysis to Identify Source Code Supply Chain Attacks16 Oct 2025
- 2025Automatically Generating Rules of Malicious Software Packages via Large Language Model24 Apr 2025
- 2025Detecting Malicious Source Code in PyPI Packages with LLMs: Does RAG Come in Handy?18 Apr 2025
- 2024Leveraging Large Language Models to Detect npm Malicious Packages18 Mar 2024
- 2026"Do Not Mention This to the User": Detecting and Understanding Malicious Agent Skills in the Wildcited by 48
- 2026Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packagescited by 1
- 2026Setup Complete, Now You Are Compromised: Weaponizing Setup Instructions Against AI Coding Agentscited by 1
- 2026CHASE: LLM Agents for Dissecting Malicious PyPI Packagescited by 0
- 2026Setup Complete, Now You Are Compromised: Weaponizing Setup Instructions Against AI Coding Agents16 Jul 2026
- 2026"Do Not Mention This to the User": Detecting and Understanding Malicious Agent Skills in the Wild6 Feb 2026
- 2026Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packages17 Jan 2026
- 2026CHASE: LLM Agents for Dissecting Malicious PyPI Packages11 Jan 2026
- 2024Leveraging Large Language Models to Detect npm Malicious Packagescited by 6
- 2026ClawHub Security Signals: When VirusTotal, Static Analysis, and SkillSpector Disagreecited by 5
- 2025Automatically Generating Rules of Malicious Software Packages via Large Language Modelcited by 2
- 2025AutoMalDesc: Large-Scale Script Analysis for Cyber Threat Researchcited by 1
- 2026Broken on Arrival: Silently Defective LLM Artifacts in Public Model Registries and How to Catch Themcited by 1
- 2025Leveraging Code Cohesion Analysis to Identify Source Code Supply Chain Attackscited by 0
- 2025One Detector Fits All: Robust and Adaptive Detection of Malicious Packages from PyPI to Enterprisescited by 0
- 2026One RNG to Rule Them All: How Randomness Becomes an Attack Vector in Machine Learningcited by 0
- 2026eDySec: A Deep Learning-based Explainable Dynamic Analysis Framework for Detecting Malicious Packages in PyPI Ecosystemcited by 0
- 2026LCC-LLM: Leveraging Code-Centric Large Language Models for Malware Attributioncited by 0
- 2026LLM-Enhanced Hierarchical Heterogeneous Graph Representation Learning for Malicious Python Package Detectioncited by 0
- 2026From Adoption to Deployment: A Qualitative Study on AI Integration in Software Development Practicecited by 0
- 2026Broken on Arrival: Silently Defective LLM Artifacts in Public Model Registries and How to Catch Them5 Sep 2026
- 2026From Adoption to Deployment: A Qualitative Study on AI Integration in Software Development Practice18 Jul 2026
- 2026LLM-Enhanced Hierarchical Heterogeneous Graph Representation Learning for Malicious Python Package Detection3 Jul 2026
- 2026ClawHub Security Signals: When VirusTotal, Static Analysis, and SkillSpector Disagree31 May 2026
- 2026LCC-LLM: Leveraging Code-Centric Large Language Models for Malware Attribution7 May 2026
- 2026eDySec: A Deep Learning-based Explainable Dynamic Analysis Framework for Detecting Malicious Packages in PyPI Ecosystem29 Apr 2026
- 2026One RNG to Rule Them All: How Randomness Becomes an Attack Vector in Machine Learning9 Feb 2026
- 2025One Detector Fits All: Robust and Adaptive Detection of Malicious Packages from PyPI to Enterprises3 Dec 2025
- 2025AutoMalDesc: Large-Scale Script Analysis for Cyber Threat Research17 Nov 2025
- 2025Leveraging Code Cohesion Analysis to Identify Source Code Supply Chain Attacks16 Oct 2025
- 2025Automatically Generating Rules of Malicious Software Packages via Large Language Model24 Apr 2025
- 2024Leveraging Large Language Models to Detect npm Malicious Packages18 Mar 2024