arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2601.12148cs.SE
收藏

众手成炬:基于LLM的多智能体系统用于检测恶意PyPI包

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

Università degli studi dell’Aquila(阿奎拉大学)

Muhammad Umar Zeshan, Motunrayo Ibiyo, Claudio Di Sipio, Phuong T. Nguyen, Davide Di Ruscio

AI总结:

本文提出LAMPS,一种基于LLM的多智能体系统,通过协作检测恶意PyPI包,实现高准确率和显著的性能提升。

摘要:

开源仓库中的恶意代码,如PyPI,对软件供应链构成了日益增长的威胁。传统的基于规则的工具往往忽视了源代码中的语义模式,这些模式对于识别对抗性组件至关重要。大型语言模型(LLMs)在软件分析中显示出潜力,但其在可解释和模块化的安全管道中的应用仍然有限。本文提出了LAMPS,一个利用协作LLMs检测恶意PyPI包的多智能体系统。该系统由四个具有特定角色的智能体组成:包检索、文件提取、分类和裁决汇总,通过CrewAI框架协调。一个原型结合了微调的CodeBERT模型用于分类,以及LLaMA-3智能体用于上下文推理。LAMPS已在两个互补的数据集上进行了评估:D1是一个平衡的6000个setup.py文件集合,D2是一个具有1296个文件和自然类不平衡的现实多文件数据集。在D1上,LAMPS实现了97.7%的准确率,超过了MPHunter——一种最先进的方法。在D2上,它达到了99.5%的准确率和99.5%的平衡准确率,优于基于RAG的方法和微调的单智能体基线。McNemar检验确认这些改进具有高度显著性。结果展示了分布式LLM推理在恶意代码检测中的可行性,并突显了模块化多智能体设计在软件供应链安全中的优势。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑