跳到内容
返回文章列表
security2 min

indexed-btree:绕过npm v12安装脚本限制的npm恶意软件

indexed-btree: npm malware that slipped past npm v12's install-script gate

KGA IT
2026-09-17更新:2 min
SecuritySupply ChainnpmMalwareJavaScriptDevSecOps
npm indexed-btree malware — KGA IT

发生了什么

2026年9月17日,Checkmarx Zero发布分析,揭露一起围绕npm包 indexed-btree 的供应链攻击。该包仿冒合法库 sorted-btree,同一运营者还发布了9个相关包,合计 每周下载量超过530万次。Snyk于9月7日将indexed-btree所有版本标记为恶意,截至9月20日,10个包均已被移除。

涉及的包:indexed-btree、ordered-kv-index、btree-leaderboard、priority-slot-queue、btree-range-store、btree-core、btree-time-index、btree-lru-cache、neighbor-key-map、sliding-score-window。

新手法:运行时恶意代码

自2026年7月起,npm v12 要求明确批准才能执行安装脚本(preinstall、install、postinstall)。而indexed-btree 根本没有安装脚本。加载器藏在应用频繁调用的 BTree.prototype.set() 方法中,只有当键值宽松等于100时才触发,使静态分析和沙箱更难发现。

其他细节:

  • 恶意代码 只存在于npm发布的tarball中,GitHub仓库里没有;
  • GitHub提交历史被伪造,可追溯到2025年12月;
  • 通过 Slack和Telegram 外传数据,第二阶段载荷从 以太坊Sepolia测试网的智能合约 获取,没有可封堵的域名;
  • 恶意软件可自我删除。

现在该做什么

  1. 在lockfile、SBOM、镜像和CI缓存中搜索这些包名。
  2. 如有发现,先保留证据,再 轮换npm令牌、Git凭据、云密钥和CI密钥。
  3. 不要只依赖安装脚本拦截,应监控构建和开发机器的运行时行为。

来源

携手解决您的技术挑战

KGA IT Solutions 拥有 AI、云计算、DevOps 专业团队,为您的业务挑战提供最佳方案。

联系我们