Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packages

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Zeshan, Muhammad Umar, Ibiyo, Motunrayo, Di Sipio, Claudio, Nguyen, Phuong T., Di Ruscio, Davide
Formato: Preprint
Publicado: 2026
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866910000664805376
author Zeshan, Muhammad Umar
Ibiyo, Motunrayo
Di Sipio, Claudio
Nguyen, Phuong T.
Di Ruscio, Davide
author_facet Zeshan, Muhammad Umar
Ibiyo, Motunrayo
Di Sipio, Claudio
Nguyen, Phuong T.
Di Ruscio, Davide
contents Malicious code in open-source repositories such as PyPI poses a growing threat to software supply chains. Traditional rule-based tools often overlook the semantic patterns in source code that are crucial for identifying adversarial components. Large language models (LLMs) show promise for software analysis, yet their use in interpretable and modular security pipelines remains limited. This paper presents LAMPS, a multi-agent system that employs collaborative LLMs to detect malicious PyPI packages. The system consists of four role-specific agents for package retrieval, file extraction, classification, and verdict aggregation, coordinated through the CrewAI framework. A prototype combines a fine-tuned CodeBERT model for classification with LLaMA-3 agents for contextual reasoning. LAMPS has been evaluated on two complementary datasets: D1, a balanced collection of 6,000 setup.py files, and D2, a realistic multi-file dataset with 1,296 files and natural class imbalance. On D1, LAMPS achieves 97.7% accuracy, surpassing MPHunter--one of the state-of-the-art approaches. On D2, it reaches 99.5% accuracy and 99.5% balanced accuracy, outperforming RAG-based approaches and fine-tuned single-agent baselines. McNemar's test confirmed these improvements as highly significant. The results demonstrate the feasibility of distributed LLM reasoning for malicious code detection and highlight the benefits of modular multi-agent designs in software supply chain security.
format Preprint
id arxiv_https___arxiv_org_abs_2601_12148
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packages
Zeshan, Muhammad Umar
Ibiyo, Motunrayo
Di Sipio, Claudio
Nguyen, Phuong T.
Di Ruscio, Davide
Software Engineering
Malicious code in open-source repositories such as PyPI poses a growing threat to software supply chains. Traditional rule-based tools often overlook the semantic patterns in source code that are crucial for identifying adversarial components. Large language models (LLMs) show promise for software analysis, yet their use in interpretable and modular security pipelines remains limited. This paper presents LAMPS, a multi-agent system that employs collaborative LLMs to detect malicious PyPI packages. The system consists of four role-specific agents for package retrieval, file extraction, classification, and verdict aggregation, coordinated through the CrewAI framework. A prototype combines a fine-tuned CodeBERT model for classification with LLaMA-3 agents for contextual reasoning. LAMPS has been evaluated on two complementary datasets: D1, a balanced collection of 6,000 setup.py files, and D2, a realistic multi-file dataset with 1,296 files and natural class imbalance. On D1, LAMPS achieves 97.7% accuracy, surpassing MPHunter--one of the state-of-the-art approaches. On D2, it reaches 99.5% accuracy and 99.5% balanced accuracy, outperforming RAG-based approaches and fine-tuned single-agent baselines. McNemar's test confirmed these improvements as highly significant. The results demonstrate the feasibility of distributed LLM reasoning for malicious code detection and highlight the benefits of modular multi-agent designs in software supply chain security.
title Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packages
topic Software Engineering
url https://arxiv.org/abs/2601.12148