跳到正文
北京时间
原文
Wiz:Research· Benjamin Read·· 3 小时前精选AI 评分83

Wiz 披露 LiteLLM PyPI 包供应链攻击,恶意版本 v1.107.0 窃取凭据

LiteLLM Compromised, Steals Credentials

AI 导读

Wiz 披露 10 月 21 日 11:39 UTC 有恶意版本 LiteLLM 1.107.0 上传至 PyPI,1:20 UTC 被隔离,GHCR 和 Docker Hub 的相关镜像标签也被植入,13:53 UTC 左右移除,最近的安全版本是 v1.106.2。

推荐理由

原文给出完整的攻击时间线、窃取目标和 IOC 清单,读者可以据此排查自身环境是否受影响。

正文 · AI 翻译

译文尚不完整,完整内容请切换到原文。

LiteLLM 遭入侵

10 月 21 日 11:39 UTC,LiteLLM 包的恶意版本(1.107.0)被上传至 PyPI。该版本已于 1:20 UTC 在 PyPI 上被隔离。

GHCR 和 Docker Hub 上的 LiteLLM Docker 容器也包含了被植入木马的 LiteLLM 版本。这些包括 v1.107.0、latest、main-latest 和 main-stable 标签。它们已于约 13:53 UTC 被移除。

最新的安全版本是 v1.106.2。

安装恶意包时,三个文件会被直接解压到 site-packages 根目录:cook.pth、cook.py 和 sitecustomize.py。这些包被设计为在每次启动 Python 解释器时执行。

更新

  • 14:05 UTC - 添加 IOC 表

  • 14:15 UTC - 添加攻击提交详情

  • 14:40 UTC - 添加凭据窃取器详情,注明 Docker 下架

载荷

Upon startup, the interpreter processes cook.pth, which includes a command to import cook, which loads cook.py. cook.py deobfuscates itself, runs a stealer routine and writes a maker to /tmp/.pc_once_72129118c59f5636c0bb (note this fails on Windows, as the /tmp/ path often does not exist). The stealer routine gathers system, browser, developer, cloud and AI tool secrets, encrypts them and exfiltrates to www.litellm.dev/healthcheck via a post request. This domain is attacker controlled, impersonating LiteLLM infrastructure.

Python 解释器还会尝试执行 sitecustomize.py——不过,它只会在 Linux 和 MacOS 机器上运行。该脚本会尝试从 GitHub 死信箱(letters9813/pythonclient-test/main/domain.txt))获取 domain.txt。如果收到响应,它会尝试从 http://<domain>/codepy 下载第二阶段 Python 脚本并运行。截至分析时,domain.txt 文件从未被填充。该仓库已于 1:30 PM UTC 被下架。

凭据窃取器

嵌入的凭据窃取器内部名称为 privcollect,通过 16 个模块收集针对浏览器、云提供商和 AI 服务的敏感数据。它会提取:

  • 来自 Chrome、Firefox、Edge 和 Safari 的浏览器凭据和 Cookie

  • 来自 ~/.aws/、环境变量以及 EC2/ECS 实例元数据(IMDS)的 AWS 凭据

  • GCP 服务账号密钥和应用默认凭据

  • 来自 CLI 缓存的 Azure 令牌

在 AI 特定窃取方面,它针对存储在环境变量或配置文件中的 OpenAI、Anthropic、Cohere 及其他 LLM 提供商的 API 密钥。它还会收集 SSH 私钥、GPG 密钥和 shell 历史文件。

LiteLLM Proxy 将上游 API 密钥存储在 PostgreSQL 数据库中。窃取器会直接查询该数据库(SELECT * FROM "LiteLLM_CredentialsTable" LIMIT 500)以提取所有已配置的提供商凭据。

收集到的数据使用 AES-256-CBC 加密(密钥用 RSA-4096 封装),并通过 HTTP 外泄至 www.litellm[.]dev/healthcheck,使用硬编码的 X-Token 头和 Internet Explorer 7 用户代理字符串。

攻击者提交

该载荷源自对 github.com/Berri-AI/litellm 的恶意提交。注意,这是合法 BerriAI 组织的连字符变体。该仓库在 GitHub 上不可见,被用于将载荷注入发布流水线。

10 月 21 日 08:56 至 10:46 UTC 之间,攻击者使用作者邮箱 ckdi82fkoos@proton.me 推送了 10 次提交。前九次提交是在 GitHub.com 上创建的,因此带有 GitHub 的已验证签名。

前三次提交(在 2 分钟内)添加了持久化文件:cook.pth、cook.py 和 sitecustomize.py。另外四次提交将版本号提升至 1.107.0。

在 39 分钟的间隔后,两次提交完善了载荷,并向 pyproject.toml 添加了关键的 data = "cook" 指令,该指令指示构建工具将恶意软件打包进 wheel。

最后一次提交发生在 58 分钟后,使用了不同的邮箱(Berri-AI@users.noreply.github.com)且未签名(表明处于不同环境),向 Dockerfile 中添加了 COPY cook ./cook。

尽管 Berri-AI 仓库已不可用,但由于 Git 的 fork 对象共享机制,所有提交仍可通过父仓库访问。完整 diff 见:github.com/BerriAI/litellm/compare/a8113b0d...20535d8f

建议

Wiz 客户应查看我们的威胁情报中心公告:针对 LiteLLM 的供应链攻击。

入侵指标

指标描述类型
litellm[.]dev攻击者控制的窃取通道(仿冒域名)网络
www.litellm[.]dev/healthcheck 数据外传端点网络
http://{domain}/codepy动态第二阶段 RCE 载荷(从未观察到活跃)网络
X-Token: XWiA8gZNa7NcX2XRoAEb硬编码的窃取认证头网络
/tmp/.pc_once_72129118c59f5636c0bb 一次性运行标记文件主机
PRIVCOLLECT_ACTIVE=1环境变量指标主机

cook.pth Windows: 84dc8c82c0a4a4a62552ef826b49fcc86d1a5c4a5d0f2c06665723f93d129d7d Linux/macOS: 7f191632e7320705d154b85204f1ae546b543acbd7e8861229b76f5042b92bdb

.pth 持久化钩子(12 字节)主机

cook.py Windows: 03ac2a8b752605d1d7710979c17ff18b03dd978203ba23ba97fd8ce3d6f897ea Linux/macOS: 9dd0a3926f96a37eb86cf1ee2310d9be93139cc4ebef3ef9e2efe9531390be25

凭据窃取载荷(22,252 字节)主机

sitecustomize.py Windows: b6122440d0d9cb1eb1ade9933f49214da8c31288de7710c076c2680dfa528465 Linux/macOS: 34bef04fe88ac9d0aae0475630b1738681d15b94f233ac8aa46eacf5968305fa

带每小时后门循环的加载器(25,509 字节)主机

受影响实例

文件/镜像SHA256
litellm-1.107.0-cp310-abi3-macosx_10_12_x86_64.whl7598727f209d717041db37f7dca271d3a7d328a279890e0e1d55375729aeb86d
litellm-1.107.0-cp310-abi3-macosx_11_0_arm64.whl0aaf7ba346d41ef2f40390436738b001180d5a1c03aa093f121078a9969d9a1a
litellm-1.107.0-cp310-abi3-manylinux_2_28_aarch64.whl668169d35b87bf51324080390b1b1c5ab12bd335cfe5f1a99e3689abd5e02ae6
litellm-1.107.0-cp310-abi3-manylinux_2_28_x86_64.whl462d0c9f67ca522d9e0e4acd245e90b36ce0d5353604a66bb7c43a1ec4a6fcf7
litellm-1.107.0-cp310-abi3-musllinux_1_2_aarch64.whlc2e32d0ce2548aa662c18bf5001911a79fe5b30cf8357132275add02fdcde054
litellm-1.107.0-cp310-abi3-musllinux_1_2_x86_64.whl1bbce8caa94f01c0aaa0b7ddae51553a8a32e1ce53d96d44fe583272aff7ad00
litellm-1.107.0-cp310-abi3-win_amd64.whl12d4ccc5c6f8d35cf4f2cf233b7f3e418e863e657d81ff5f5fc9e210005b9484
ghcr.io/berriai/litellm:v1.107.0

linux/amd64 sha256:bd1aeee419ea36da9aa2b657288da4101887be468f020ac63d22ba6ed84a3ea5 linux/arm64 sha256:56b74573eed6e4aafe4b50603dbe7853e0345f188c8e44a09f1098caf1f4bcdf

ghcr.io/berriai/litellm-database:v1.107.0

linux/amd64 sha256:24581ddc30767f16ecb69d2b0517556f2cd7dea56971adb42a3d1beb97d69523 linux/arm64 sha256:827dd893c74cf621a860a66a3a447a5c732533f087589ce905573e285c0a239c

ghcr.io/berriai/litellm-non_root:v1.107.0linux/amd64 sha256:645a67d810628252d63df85dcc8824c58bcc77cf8383f4d3e6321f0ccc3ce9e4 linux/arm64 sha256:f75c8edae59b72b1ebfd617295833f465c85bb2fab9c1d60f21b496db86cb8da
docker.io/litellm/litellmlinux/amd64 sha256:bd1aeee419ea36da9aa2b657288da4101887be468f020ac63d22ba6ed84a3ea5 linux/arm64 sha256:56b74573eed6e4aafe4b50603dbe7853e0345f188c8e44a09f1098caf1f4bcdf

来源:Wiz:Research · wiz.io