今天刚发生的重大安全事件,Karpathy 亲自发帖警告。
litellm 被投毒:一次教科书级的供应链攻击
今天(3月24日),AI 开发者常用的 Python 库 litellm 在 PyPI 上被植入恶意代码。版本 1.82.8 在 UTC 时间 10:52 发布到 PyPI,包含一个名为 litellm_init.pth 的恶意文件,会在每次 Python 进程启动时自动执行。不需要你主动调用这个库,装上就中招。
litellm 是干什么的?它是一个统一调用各家大模型 API 的 Python 库,GitHub 超过 4 万星,每月下载量超过 9500 万次。很多 AI 工具链都依赖它,包括 DSPy、MLflow、Open Interpreter 等,总共有 2000 多个包把它当作依赖项。
也就是说,你可能从来没有手动安装过 litellm,但你用的某个工具替你装了。
恶意代码会系统性地收集主机上的敏感数据:SSH 密钥、AWS/GCP/Azure 云凭证、Kubernetes 密钥、环境变量文件、数据库配置,甚至加密货币钱包。收集完毕后加密打包,发送到攻击者控制的域名。
如果检测到 Kubernetes 环境,恶意代码还会利用服务账户令牌在集群的每个节点上部署特权 Pod,进行横向扩散。
怎么发现的?攻击者自己写了个 bug
发现过程颇具讽刺意味。FutureSearch 的 Callum McMahon 在 Cursor 编辑器里用了一个 MCP 插件,这个插件间接依赖了 litellm。恶意 .pth 文件在每次 Python 启动时都会触发,子进程又触发同一个 .pth,形成指数级的 fork bomb,直接把机器内存撑爆了。
Karpathy 在推文里说得很清楚:如果攻击者没有在写恶意代码时犯这个 bug,这个投毒可能好几天甚至好几周都不会被发现。
攻击链:安全工具反成突破口
根源在于 litellm 的 CI/CD 流程中使用了 Trivy(一个漏洞扫描工具),而 Trivy 本身在 3 月 19 日就已经被同一个攻击组织 TeamPCP 攻陷了。攻击者通过被污染的 Trivy 窃取了 litellm 的 PyPI 发布令牌,然后直接往 PyPI 上推送了带毒版本。
litellm 1.82.7 在 UTC 10:39 发布,1.82.8 在 10:52 发布,两个版本都包含恶意代码。
时间线更完整地看:3月19日 TeamPCP 攻陷 Trivy,3月23日攻陷 Checkmarx KICS,3月24日轮到 litellm。Wiz 安全研究员 Gal Nagli 的评价是:开源供应链正在形成连锁崩塌,Trivy 被攻破导致 litellm 被攻破,数万个环境的凭证落入攻击者手中,而这些凭证又会成为下一次攻击的弹药。
攻击者还试图“灭口”
社区成员在 GitHub 上提交 issue 报告此事后,攻击者在 102 秒内用 73 个被盗账号发了 88 条垃圾评论试图淹没讨论,然后利用被盗的维护者账号把 issue 关闭。社区不得不另开 issue 并转移到 Hacker News 继续讨论。
Karpathy 借此事重提了他对软件依赖的警惕态度:供应链攻击是现代软件中最可怕的威胁,每次安装一个依赖,都可能在依赖树的深处引入一个被投毒的包。他现在越来越倾向于用大模型直接生成简单功能的代码,而不是引入外部依赖。
如果你的环境中有 litellm,立刻运行 pip show litellm 检查版本。1.82.6 是最后一个干净版本。如果不幸装了 1.82.7 或 1.82.8,假设所有凭证已泄露,立即轮换。
Software horror: litellm PyPI supply chain attack.
Simple `pip install litellm` was enough to exfiltrate SSH keys, AWS/GCP/Azure creds, Kubernetes configs, git credentials, env vars (all your API keys), shell history, crypto wallets, SSL private keys, CI/CD secrets, database passwords.
LiteLLM itself has 97 million downloads per month which is already terrible, but much worse, the contagion spreads to any project that depends on litellm. For example, if you did `pip install dspy` (which depended on litellm>=1.64.0), you'd also be pwnd. Same for any other large project that depended on litellm.
Afaict the poisoned version was up for only less than ~1 hour. The attack had a bug which led to its discovery - Callum McMahon was using an MCP plugin inside Cursor that pulled in litellm as a transitive dependency. When litellm 1.82.8 installed, their machine ran out of RAM and crashed. So if the attacker didn't vibe code this attack it could have been undetected for many days or weeks.
Supply chain attacks like this are basically the scariest thing imaginable in modern software. Every time you install any depedency you could be pulling in a poisoned package anywhere deep inside its entire depedency tree. This is especially risky with large projects that might have lots and lots of dependencies. The credentials that do get stolen in each attack can then be used to take over more accounts and compromise more packages.
Classical software engineering would have you believe that dependencies are good (we're building pyramids from bricks), but imo this has to be re-evaluated, and it's why I've been so growingly averse to them, preferring to use LLMs to "yoink" functionality when it's simple enough and possible.
日经牛市结束,止盈 2026.03.14【Jimmy东京价值投资】 youtu.be/NRnyI1YqTuU?si=L2s4… 来自 @YouTube
1
5
913
这应该是我看过的关于 Claude Code 和 Codex 最详细的对比文了。
先上结论!作者之前用了几个月的 Claude Code,后来去深度体验了新版的 Codex,但最终还是果断切回了基于 Opus 4.6 的 Claude 生态。
从底层模型极限、技术栈差异、实际开发体感、RAG 项目实测,以及定价与生态这几个方面进行了深度拆解:
在模型耐力上,Opus 4.6 能 hold 住长达 12 小时工作量的复杂任务,比 Codex 更能啃硬骨头。
Claude 像个靠谱的资深同事,不仅交互感强,还会自己做端到端测试,遇到报错主动帮你修环境。Codex 则更像个技术极客外包,给出的代码架构(比如 OOP 设计和配置项)非常优雅,但在配环境和 debug 方面经常需要手动介入。
在实测手搓 RAG 系统的时,Codex 的代码更具工程美感,但跑起来需要人工干预。而 Claude 凭借零修改直接跑通的顺滑度赢得了测试。
不过最大的差异可能还是价格和工具生态。Claude 提供了一个 100 刀/月的中档套餐,这对于很多人来说性价比极高,不用被迫去承担 200 刀的顶配。加上目前 Anthropic 的全家桶体验,确实比 OpenAI 那边有些碎片化的工具链要丝滑不少。
止盈日股,买房 2026.03.06【Jimmy东京价值投资】 youtu.be/dUS3InDF9AU?si=kriX… 来自 @YouTube
1
2
289
止盈2802味之素,获利30% 2026.02.10【Jimmy东京价值投资】 youtu.be/GKnsx2osttE?si=TX7y… 来自 @YouTube
1
269





























