An Empirical Study of Malicious Code In PyPI Ecosystem
Authors:
- 11 September 2023
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 166-177
Abstract
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.Keywords
All Related Versions
Funding Information
- National Research Foundation, Singapore
- National key research and development program (2022YFB3305203)
- National Natural Science Foundation of China (U2133208)
This publication has 19 references indexed in Scilit:
- PBDT: Python Backdoor Detection Model Based on Combined FeaturesSecurity and Communication Networks, 2021
- LastPyMile: identifying the discrepancy between sources and packages2021
- Anomalicious: Automated Detection of Anomalous and Potentially Malicious Commits on GitHub2021
- Cyber-guided Deep Neural Network for Malicious Repository Detection in GitHub2020
- Backstabber’s Knife Collection: A Review of Open Source Software Supply Chain Attacks2020
- Large Scale Characterization of Software Vulnerability Life CyclesIEEE Transactions on Dependable and Secure Computing, 2019
- Ecosystem-level determinants of sustained activity in open-source projects: a case study of the PyPI ecosystem2018
- Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Security2017
- Understanding Android App Piggybacking: A Systematic Study of Malicious Code GraftingIEEE Transactions on Information Forensics and Security, 2017
- AZSecure Hacker Assets Portal: Cyber threat intelligence and malware analysis2016