Bad Snakes: Understanding and Improving Python Package Index Malware Scanning
Duc-Ly Vu, Zachary Newman, John Speed Meyers
Abstract
While attackers often distribute malware to victims via open-source, community-driven package repositories, these repositories do not currently run automated malware detection systems. In this work, we explore the security goals of the repository administrators and the requirements for deployments of such malware scanners via a case study of the Python ecosystem and PyPI repository, which includes interviews with administrators and maintainers. Further, we evaluate existing malware detection techniques for deployment in this setting by creating a benchmark dataset and comparing several existing tools, including the malware checks implemented in PyPI, Ban-dit4Mal, and OSSGadget's OSS Detect Backdoor.
We find that repository administrators have exacting technical demands for such malware detection tools. Specifically, they consider a false positive rate of even 0.01% to be unacceptably high, given the large number of package releases that might trigger false alerts. Measured tools have false positive rates between 15% and 97%; increasing thresholds for detection rules to reduce this rate renders the true positive rate useless. In some cases, these checks emitted alerts more often for benign packages than malicious ones. However, we also find a successful socio-technical malware detection system: external security researchers also perform repository malware scans and report the results to repository administrators. These parties face different incentives and constraints on their time and tooling. We conclude with recommendations for improving detection capabilities and strengthening the collaboration between security researchers and software repository administrators.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
8 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Efficient Code Analysis via Graph Representation Learning-Guided Large Language Models cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- Efficient Code Analysis via Graph Representation Learning-Guided Large Language Models cites Leveraging Large Language Models to Detect NPM Malicious Packages
- SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and Matching cites LastPyMile: identifying the discrepancy between sources and packages
- SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and Matching cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and Matching cites SoK: Taxonomy of Attacks on Open-Source Software Supply Chains
- SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and Matching cites Practical Automated Detection of Malicious npm Packages
- LastPyMile: identifying the discrepancy between sources and packages cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- Bridging Expert Reasoning and LLM Detection: A Knowledge-Driven Framework for Malicious Packages cites SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and Matching
- Bridging Expert Reasoning and LLM Detection: A Knowledge-Driven Framework for Malicious Packages cites Practical Automated Detection of Malicious npm Packages
- Bridging Expert Reasoning and LLM Detection: A Knowledge-Driven Framework for Malicious Packages cites Leveraging Large Language Models to Detect NPM Malicious Packages
- SoK: Taxonomy of Attacks on Open-Source Software Supply Chains cites LastPyMile: identifying the discrepancy between sources and packages
- SoK: Taxonomy of Attacks on Open-Source Software Supply Chains cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- SoK: Taxonomy of Attacks on Open-Source Software Supply Chains cites Practical Automated Detection of Malicious npm Packages
- Practical Automated Detection of Malicious npm Packages cites LastPyMile: identifying the discrepancy between sources and packages
- Practical Automated Detection of Malicious npm Packages cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- Leveraging Large Language Models to Detect NPM Malicious Packages cites LastPyMile: identifying the discrepancy between sources and packages
- Leveraging Large Language Models to Detect NPM Malicious Packages cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- Leveraging Large Language Models to Detect NPM Malicious Packages cites Practical Automated Detection of Malicious npm Packages
- Cutting the Gordian Knot: Detecting Malicious PyPI Packages via a Knowledge-Mining Framework cites LastPyMile: identifying the discrepancy between sources and packages
- Cutting the Gordian Knot: Detecting Malicious PyPI Packages via a Knowledge-Mining Framework cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- Cutting the Gordian Knot: Detecting Malicious PyPI Packages via a Knowledge-Mining Framework cites Practical Automated Detection of Malicious npm Packages
- Cutting the Gordian Knot: Detecting Malicious PyPI Packages via a Knowledge-Mining Framework cites Leveraging Large Language Models to Detect NPM Malicious Packages
- What the Fork? Finding Hidden Code Clones in npm cites Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
Cited by top-tier papers8
- Leveraging Large Language Models to Detect NPM Malicious PackagesNusrat Zahan, Philipp Burckhardt, Mikola Lysenko, Feross Aboukhadijeh et al.ICSE 2025 · 8 citations
- SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and MatchingYiheng Huang, Ruisi Wang, Wen Zheng, Zhuotong Zhou et al.ASE 2024 · 4 citations
- Efficient Code Analysis via Graph Representation Learning-Guided Large Language ModelsHang Gao, Tao Peng, Baoquan Cui, Hong Huang et al.ICML 2026 · 1 citation
- Cutting the Gordian Knot: Detecting Malicious PyPI Packages via a Knowledge-Mining FrameworkWenbo Guo, Chengwei Liu, Ming Kang, Yiran Zhang et al.USENIX Security 2026 · 1 citation
- Bridging Expert Reasoning and LLM Detection: A Knowledge-Driven Framework for Malicious PackagesWenbo Guo, Shiwen Song, Jiaxun Guo, Zhengzi Xu et al.WWW 2026
Builds on5
- Practical Automated Detection of Malicious npm PackagesAdriana Sejfia, Max SchäferICSE 2022 · 65 citations
- LastPyMile: identifying the discrepancy between sources and packagesDuc-Ly Vu, Fabio Massacci, Ivan Pashchenko, Henrik Plate et al.FSE 2021 · 53 citations
- What the Fork? Finding Hidden Code Clones in npmElizabeth Wyss, Lorenzo De Carli, Drew DavidsonICSE 2022 · 10 citations
- Towards Measuring Supply Chain Attacks on Package Managers for Interpreted LanguagesRuian Duan, Omar Alrawi, Ranjita Pai Kasturi, Ryan Elder et al.NDSS 2021
- SoK: Taxonomy of Attacks on Open-Source Software Supply ChainsPiergiorgio Ladisa, Henrik Plate, Matias Martinez, Olivier BaraisS&P 2023
Related papers
- An Empirical Study of Malicious Code In PyPI EcosystemWenbo Guo, Zhengzi Xu, Chengwei Liu, Cheng Huang et al.ASE 2023 · 31 citations
- PyFEX: Uncovering Evasive Python-based Threats via Resilient and Exhaustive Path ExplorationMeng Wang, Yue Ma, Majid Garoosi, Wenting Fan et al.CCS 2026
- A Needle is an Outlier in a Haystack: Hunting Malicious PyPI Packages with Code ClusteringWentao Liang, Xiang Ling, Jingzheng Wu, Tianyue Luo et al.ASE 2023 · 15 citations
- Uncovering Similar but Different Packages in PyPI and Potential Security ThreatsSunha Park, Soojin Han, Seunghoon WooFSE 2026
- ConfuGuard: Using Metadata to Detect Active and Stealthy Package Confusion Attacks Accurately and at ScaleWenxin Jiang, Berk Çakar, Mikola Lysenko, James C DavisICSE 2026 · 2 citations
