Skip to main content
QUICK REVIEW

[论文解读] I Know What You Imported Last Summer: A study of security threats in thePython ecosystem

Aadesh Bagmar, Josiah Wedgwood|arXiv (Cornell University)|Feb 11, 2021
Cybercrime and Law Enforcement Studies参考文献 1被引用 4
一句话总结

本文研究了Python软件包生态(PyPI)中的关键安全漏洞,展示了攻击者如何利用安装时代码执行、伪装流行软件包以及通过传递依赖导致广泛许可证违规。研究发现,0.78%的软件包在安装时执行代码,平均每个安装过程隐式信任14个软件包,且由于不兼容的依赖关系导致超过1,500起许可证违规事件,凸显了软件包信任与许可证管理中的系统性风险。

ABSTRACT

The popularity of Python has risen rapidly over the past 15 years. It is a major language in some of the most exciting technologies today. This popularity has led to a large ecosystem of third-party packages available via the pip package registry which hosts more than 200,000 packages. These third-party packages can be reused by simply importing the package after installing using package managers like pip. The ease of reuse of third-party software comes with security risks putting millions of users in danger. In this project, we study the ecosystem to analyze this threat. The mature ecosystem of Python has multiple weak spots that we highlight in our project. First, we demonstrate how trivial it is to exploit the Python ecosystem. Then, we systematically analyze dependencies amongst packages, maintainers, and publicly reported security issues. Most attacks are possible only if users install malicious packages. We thus try to analyze and evaluate different methods used by attackers to force incorrect downloads. We quantify your ideas by estimating the potential threat that can be caused by exploiting a popular Python package. We also discuss methods used in the industry to defend against such attacks

研究动机与目标

  • 分析Python软件包生态(PyPI)中的安全风险,特别是第三方软件包重用所引发的问题。
  • 研究攻击者如何利用软件包安装过程实现权限提升或执行恶意代码。
  • 量化软件包伪装和拼写劫持攻击对用户信任与系统安全的影响。
  • 识别并分析PyPI软件包中因不兼容的传递依赖导致的开源许可证违规问题。
  • 评估现有防护措施,并提出切实可行的改进方案以增强Python生态系统的安全性。

提出的方法

  • 收集并分析了206,296个PyPI软件包、150万次发布版本以及387,867名维护者元数据,构建依赖图谱。
  • 通过识别在安装过程中执行代码的软件包(包括安装时的导入和函数调用)来追踪软件包的安装行为。
  • 通过计算给定软件包在安装过程中隐式信任的软件包和维护者数量,衡量隐式信任程度。
  • 分析软件包名称及拼写错误,检测伪装攻击与拼写劫持攻击,包括善意开发者实施的防御性伪装。
  • 通过比较导入软件包的许可证类型,评估许可证兼容性,识别当宽松许可证软件包导入严格许可证依赖时产生的违规行为。
  • 使用真实案例(如SSH密钥窃取、比特币挖矿)和案例研究(如Cisco Genie)验证攻击的可行性和影响。

实验结果

研究问题

  • RQ1PyPI软件包中安装时代码执行漏洞的普遍程度如何,其在权限提升方面的潜在风险是什么?
  • RQ2PyPI生态中隐式信任的平均水平是多少,其随时间的变化趋势如何?
  • RQ3软件包伪装和拼写劫持攻击的普遍程度如何,有哪些新兴的防御实践?
  • RQ4Python生态中因传递依赖导致的开源许可证违规规模有多大?
  • RQ5在技术与政策层面,有哪些实际可行的防护措施可缓解这些威胁?

主要发现

  • 在本研究的软件包中,0.28%在安装过程中执行setup()以外的函数,0.78%在安装时导入其他软件包,表明存在显著的权限提升攻击面。
  • 平均而言,一个Python软件包在安装过程中隐式信任14个其他软件包,而排名前10,000的软件包平均信任247个软件包,表明存在高度的传递信任。
  • 平均每个维护者涉及338个软件包,且维护者的影响力随时间持续增长,使得账户被劫持的影响被进一步放大。
  • 本研究识别出672起潜在的许可证违规事件,涉及MIT许可证软件包导入GPLv3许可证依赖,另有832起涉及LGPLv3,凸显了广泛的合规风险。
  • 造成最多许可证违规的前20个软件包包括具有严格许可证的软件包,这些软件包被宽松许可证软件包导入,引发连锁合规问题。
  • 对Cisco Genie框架的真实案例研究表明,一个宽松许可证的软件包会继承其依赖项(restview)的严格许可证,导致违规行为传播至所有下游用户。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。