[pypi] setup.py install based cmdclass not executed

未关闭
#369 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
security, tooling

调研方向

首先跟踪 package-analysis 对 setup.py 安装以及报告中显示的 install cmdclass 的处理。使用提供的 setup.py 行为重现 exotel 0.1.6 案例,并将其与记录的分析结果进行比较。当分析路径能够一致地处理或报告基于 install 的 cmdclass 执行,且不会遗漏此案例时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

bug

exotel v0.1.6 downloads a malicious windows binary when setup.py is called with "install".

Unfortunately we didn't execute the malicious payload which would have called out to the domain "linkedopports[.]com" because it called the "bdist" step to create a wheel, and then installed the wheel:

Install succeeded:
Collecting exotel==0.1.6
  Downloading exotel-0.1.6.tar.gz (2.2 kB)
Building wheels for collected packages: exotel
  Building wheel for exotel (setup.py): started
  Building wheel for exotel (setup.py): finished with status 'done'
  Created wheel for exotel: filename=exotel-0.1.6-py3-none-any.whl size=1790 sha256=de7e1ccfae5d769d08346ca1091f41ff3cc753063a58240008ef9d94c0527c43
  Stored in directory: /root/.cache/pip/wheels/c6/1e/3e/71d3147d5a3a8d82f51ee372046a92751b1dfa20432f29c144
Successfully built exotel
Installing collected packages: exotel
Successfully installed exotel-0.1.6

The setup.py contained the following:

def send():
    # ... truncated ...
 
class PostInstallCommand(install):
    def run(self):
        install.run(self)
        send()

setup(
  name='exotel',
  version='0.1.6',
  description='exotel',
  python_requires=">=3.6",
  install_requires=[''],
  tests_require=[],
  cmdclass={'install': PostInstallCommand},
)

Refs: https://storage.googleapis.com/ossf-malware-analysis-results/pypi/exotel/0.1.6.json, https://osv.dev/vulnerability/GHSA-cv6j-9835-p7fh

主要语言
Go
星标
925
派生
75
平均合并
4 天 2 小时
30 天内合并 PR
3

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ossf/package-analysis 的其他 Issue

查看 ossf/package-analysis 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。