mlsanityData to 7 Oct 2026

One Detector Fits All: Robust and Adaptive Detection of Malicious Packages from PyPI to Enterprises

arXiv 2512.04338 ↗First posted 3 Dec 2025cs.CR cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

The rise of supply chain attacks via malicious Python packages demands robust detection solutions. Current approaches, however, overlook two critical challenges: robustness against adversarial source code transformations and adaptability to the varying false positive rate (FPR) requirements of different actors, from repository maintainers (requiring low FPR) to enterprise security teams (higher FPR tolerance). We introduce a robust detector capable of seamless integration into both public repositories like PyPI and enterprise ecosystems. To ensure robustness, we propose a novel methodology for generating adversarial packages using fine-grained code obfuscation. Combining these with adversarial training (AT) enhances detector robustness by 2.5x. We comprehensively evaluate AT effectiveness by testing our detector against 122,398 packages collected daily from PyPI over 80 days, showing that AT needs careful application: it makes the detector more robust to obfuscations and allows finding 10% more obfuscated packages, but slightly decreases performance on non-obfuscated packages. We demonstrate production adaptability of our detector via two case studies: (i) one for PyPI maintainers (tuned at 0.1% FPR) and (ii) one for enterprise teams (tuned at 10% FPR). In the former, we analyze 91,949 packages collected from PyPI over 37 days, achieving a daily detection rate of 2.48 malicious packages with only 2.18 false positives. In the latter, we analyze 1,596 packages adopted by a multinational software company, obtaining only 1.24 false positives daily. These results show that our detector can be seamlessly integrated into both public repositories like PyPI and enterprise ecosystems, ensuring a very low time budget of a few minutes to review the false positives. Overall, we uncovered 346 malicious packages, now reported to the community.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 22 of its 46 references that are in the map. First posted on arXiv 3 Dec 2025.

Builds on

22 of 46 references.

References · 22

  1. 2017Towards Deep Learning Models Resistant to Adversarial Attackscited by 6,326
  2. 2016XGBoost: A Scalable Tree Boosting Systemcited by 5,120
  3. 2017Wild Patterns: Ten Years After the Rise of Adversarial Machine Learningcited by 411
  4. 2018Model Evaluation, Model Selection, and Algorithm Selection in Machine Learningcited by 157
  5. 2020Dos and Don'ts of Machine Learning in Computer Securitycited by 98
  6. 2020Functionality-preserving Black-box Optimization of Adversarial Windows Malwarecited by 58
  7. 2017Yes, Machine Learning Can Be More Secure! A Case Study on Android Malware Detectioncited by 51
  8. 2023An Empirical Study of Malicious Code In PyPI Ecosystemcited by 18
  9. 2023Killing Two Birds with One Stone: Malicious Package Detection in NPM and PyPI using a Single Model of Malicious Behavior Sequencecited by 9
  10. 2022A Benchmark Comparison of Python Malware Detection Approachescited by 7
  11. 2023Nebula: Self-Attention for Dynamic Malware Analysiscited by 7
  12. 2024DONAPI: Malicious NPM Packages Detector using Behavior Sequence Knowledge Mappingcited by 6
10 more
  1. 2024Leveraging Large Language Models to Detect npm Malicious Packagescited by 6
  2. 2023On the Feasibility of Cross-Language Detection of Malicious Packages in npm and PyPIcited by 5
  3. 2024SLIFER: Investigating Performance and Robustness of Malware Detection Pipelinescited by 4
  4. 2024Towards Robust Detection of Open Source Software Supply Chain Poisoning Attacks in Industry Environmentscited by 4
  5. 2023Raze to the Ground: Query-Efficient Adversarial HTML Attacks on Machine-Learning Phishing Webpage Detectorscited by 3
  6. 2025Detecting Malicious Source Code in PyPI Packages with LLMs: Does RAG Come in Handy?cited by 3
  7. 2023Using the Uniqueness of Global Identifiers to Determine the Provenance of Python Software Source Codecited by 2
  8. 2023The Hitchhiker's Guide to Malicious Third-Party Dependenciescited by 2
  9. 2023ModSec-AdvLearn: Countering Adversarial SQL Injections with Robust Machine Learningcited by 1
  10. 2024Malicious Package Detection using Metadata Informationcited by 1

Built on by

Not cited yet.