← 回總覽

Axios npm 包在供应链攻击中被篡改

📅 2026-04-02 21:53 Daniel Curtis 软件编程 4 分鐘 4239 字 評分: 89
npm 供应链攻击 Axios 网络安全 恶意软件
📌 一句话摘要 流行的 npm 包 Axios 遭遇了一次重大供应链攻击,其 1.14.1 和 0.30.4 版本通过被劫持的维护者账户植入了远程访问木马(RAT)。 📝 详细摘要 2026 年 3 月 31 日,每周下载量超过 1 亿次的 Axios HTTP 客户端库在一次严重的供应链攻击中被篡改。恶意版本 `axios@1.14.1` 和 `axios@0.30.4` 被发布到 npm 注册表,其中包含一个功能性的远程访问木马(RAT)。此次攻击是通过一个被投毒的传递依赖 `plain-crypto-js@4.2.1` 发起的,该依赖在几分钟内就被 Socket 的自动化扫描器标记。

Title: Axios npm Package Compromised in Supply Chain Attack | BestBlogs.dev

URL Source: https://www.bestblogs.dev/article/02b65f6d

Published Time: 2026-04-02 13:53:00

Markdown Content: The npm ecosystem absorbed one of its most significant supply chain attacks on March 31, 2026, when two versions of Axios, the HTTP client library that sees over 100 million weekly downloads, were found to contain a fully functional Remote Access Trojan. The compromised releases, axios@1.14.1 and axios@0.30.4, were published to the npm registry via what appears to be a hijacked maintainer account and were live for a window long enough to reach an unknown number of developer environments before being removed.

The attack was first surfaced by Socket, whose automated malware scanner flagged the malicious transitive dependency plain-crypto-js@4.2.1 within six minutes of it appearing on the registry. That package had been seeded the previous day as a clean typosquat of the legitimate crypto-js library, then poisoned in a coordinated second publish timed to coincide with the Axios release. Both the 1.x and 0.x branches of Axios were poisoned within 39 minutes of each other, meaning any project floating on a caret range such as ^1.14.0 or ^0.30.0 would have silently pulled in the malicious code on its next install.

Neither version appears in the official Axios GitHub release tags, a break from the project's normal publish workflow that security researchers on GitHub flagged immediately. A collaborator noted publicly that the attacker's npm permissions exceeded their own, briefly preventing the team from revoking access. An Axios maintainer subsequently confirmed they are investigating how the compromise occurred, with early analysis pointing to a long-lived npm token used alongside trusted publishing as a likely attack vector.

Feross Aboukhadijeh, founder of Socket, posted on X:

> Every npm install pulling the latest version is potentially compromised right now. Socket AI analysis confirms this is malware.

Andrej Karpathy also shared his own close call, writing:

> Scanning my system I found a use imported from googleworkspace/cli from a few days ago when I was experimenting with gmail/gcal cli. The installed version (luckily) resolved to an unaffected 1.13.5, but the project dependency is not pinned, meaning that if I did this earlier today the code would have resolved to latest and I'd be pwned.

He went on to call for defaults in package managers to change so that a single compromised package cannot spread through users at random via unpinned dependencies. Discussion on Hacker News echoed this, with one commenter noting that setting ignore-scripts=true in ~/.npmrc would alone have mitigated the vulnerability, and observing that both Bun and pnpm do not run install scripts by default.

Any project affected should roll back immediately. The Axios team has formally deprecated the compromised versions on the registry. Projects using alternative HTTP clients such as the native fetch API, got, or ky were not affected. Unlike Axios, those libraries carry no native browser polyfill concerns and ship with significantly smaller dependency trees, a distinction that has prompted renewed conversation in the community about dependency minimalism as a security posture. Wiz, Snyk, Aikido, and StepSecurity have each published detailed incident analyses and remediation guidance.

查看原文 → 發佈: 2026-04-02 21:53:00 收錄: 2026-04-03 00:00:34

🤖 問 AI

針對這篇文章提問,AI 會根據文章內容回答。按 Ctrl+Enter 送出。