MalGuard: Towards Real-Time, Accurate, and Actionable Detection of Malicious Packages in PyPI Ecosystem

Xingan Gao, Xiaobing Sun, Sicong Cao, Kaifeng Huang, Di Wu, Xiaolei Liu, Xingwei Lin, Yang Xiang

34th USENIX Security Symposium · Day 1

The Python Package Index (PyPI), the official third-party software repository for Python, has become an increasingly attractive target for malicious actors. With a staggering 704,102 malicious packages discovered across third-party registries by 2024—a 156% year-on-year increase—the need for robust, real-time, and accurate detection mechanisms is paramount. This paper introduces **MalGuard**, a novel approach designed to address the escalating threat of malicious packages within the PyPI ecosystem. MalGuard stands out by demonstrating that lightweight machine learning (ML) models, when equipped with a comprehensively curated feature set, can achieve detection effectiveness comparable to more complex large language models (LLMs), but with significantly reduced computational overhead.

AI review

Competent engineering work that solves a real problem — real-time PyPI scanning with explainable outputs — but the 'novelty' is mostly gluing together well-understood pieces: graph centrality (borrowed from Android malware work), LIME for explainability, GPT for filtering. The 113 wild catches and PyPI removals are the strongest argument for relevance, not innovation.