首个大规模Python包漏洞数据集,揭示多语言协作下的安全风险
An Empirical Study of Vulnerabilities in Python Packages and Their Detection
- 构建1157个经开发者验证的漏洞数据集,支持提交与函数级标注
- 漏洞常跨语言存在,多语言包更易出问题,现有工具检测率不足
- 用LLM清洗数据提升准确率,为漏洞检测提供真实评估基准
在快速发展的软件开发环境中,Python凭借其简洁性、通用性和庞大生态成为主流。作为组织、重用和分发代码的基本单元,Python包已成为安全关注重点,已有大量漏洞报告。由于Python常与其他语言协同以提升性能或实现互操作,其漏洞复杂性增加,而现有检测工具的有效性尚未充分研究。本文提出PyVul,首个全面的Python包漏洞基准数据集,包含1,157个公开报告且经开发者验证的漏洞,每个漏洞均关联受影响的包。为适配不同检测技术,数据集提供提交级和函数级标注。采用大模型辅助的数据清洗方法,实现提交级100%、函数级94%的标注准确率,确立了当前最精确的大规模基准。对数据集的分布分析表明,漏洞涉及多种编程语言,类型多样;多语言包可能更具脆弱性。基于该基准对主流检测工具的评估显示,现有工具能力与实际需求之间存在显著差距。此外,我们对排名靠前的CWE进行了实证分析,揭示当前检测工具的细粒度局限,强调未来需进一步改进。
原文摘要 · Abstract (English)
In the rapidly evolving software development landscape, Python stands out for its simplicity, versatility, and extensive ecosystem. Python packages, as units of organization, reusability, and distribution, have become a pressing concern, highlighted by the considerable number of vulnerability reports. As a scripting language, Python often cooperates with other languages for performance or interoperability. This adds complexity to the vulnerabilities inherent to Python packages, and the effectiveness of current vulnerability detection tools remains underexplored. This paper addresses these gaps by introducing PyVul, the first comprehensive benchmark suite of Python-package vulnerabilities. PyVul includes 1,157 publicly reported, developer-verified vulnerabilities, each linked to its affected packages. To accommodate diverse detection techniques, it provides annotations at both commit and function levels. An LLM-assisted data cleansing method is incorporated to improve label accuracy, achieving 100% commit-level and 94% function-level accuracy, establishing PyVul as the most precise large-scale Python vulnerability benchmark. We further carry out a distribution analysis of PyVul, which demonstrates that vulnerabilities in Python packages involve multiple programming languages and exhibit a wide variety of types. Moreover, our analysis reveals that multi-lingual Python packages are potentially more susceptible to vulnerabilities. Evaluation of state-of-the-art detectors using this benchmark reveals a significant discrepancy between the capabilities of existing tools and the demands of effectively identifying real-world security issues in Python packages. Additionally, we conduct an empirical review of the top-ranked CWEs observed in Python packages, to diagnose the fine-grained limitations of current detection tools and highlight the necessity for future advancements in the field.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。