[SECURITY] @antv/g2 5.5.8 is a malicious release — maintainer compromise, credential stealer in preinstall script (please yank & rotate npm tokens)
Describe the bug / 问题描述
⚠️ Supply-chain compromise — @antv/[email protected] published to npm contains malware
The version 5.5.8 of @antv/g2 currently published on the npm registry is not a legitimate release. The tarball contains an obfuscated credential-stealing payload that executes on npm install via a preinstall script. This appears to be part of the active "Mini Shai-Hulud" npm supply-chain attack wave reported on 2026-05-19, which compromised multiple @antv/* packages.
npm has already marked the version as
deprecated: "risk", but the tarball is still installable. Please unpublish / yank it and rotate all maintainer npm tokens.
Affected package
| Field | Value |
|---|---|
| Package | @antv/g2 |
| Version | 5.5.8 |
| Tarball | https://registry.npmjs.org/@antv/g2/-/g2-5.5.8.tgz |
| Tarball SHA-256 | 1f9bb122788e582369731c91c9de13f6f69c37435ca93d487fa6b38178cc0dd7 |
| Size | 2,306,515 bytes |
Published by (npm _npmUser) |
atool <[email protected]> — not the usual G2 publisher |
| Status | deprecated: "risk" on the registry |
What's in the tarball
Compared to a legitimate G2 release, this tarball adds two things at the package root that should never be there:
index.js(498,431 bytes) — heavily obfuscated (obfuscator.io string-array style) malicious payload.package.jsonhas two extra fields not present in upstreammaster:"scripts": { ... "preinstall": "bun run index.js" // <-- runs the payload on every install }, "optionalDependencies": { "@antv/setup": "github:antvis/G2#1916faa365f2788b6e193514872d51a242876569" }
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
- Fetch the tarball directly (do NOT install):
curl -O https://registry.npmjs.org/@antv/g2/-/g2-5.5.8.tgz - Verify SHA-256:
sha256sum g2-5.5.8.tgz→1f9bb122788e582369731c91c9de13f6f69c37435ca93d487fa6b38178cc0dd7 - Extract with
taronly (this does not invoke npm lifecycle scripts):mkdir x && tar -xzf g2-5.5.8.tgz -C x - Compare against the official
v5.5.7git tag / tarball:- Extra file:
package/index.js(498,431 bytes, obfuscator.io output). package/package.jsonhas an added"preinstall": "bun run index.js"script.package/package.jsonhas an addedoptionalDependencies."@antv/setup"pointing to a pinned GitHub commit onantvis/G2.
- Extra file:
- Inspect
index.js(do not execute). Confirm presence of:- Regexes for
gh[op]_…,ghs_…,npm_…,AKIA…,xox[baprs]-…,SK[0-9a-f]{32},hvs\.…,-----BEGIN … PRIVATE KEY-----, JWT, URL-creds, etc. import { execSync } from 'child_process'fetch(... { tls: { rejectUnauthorized: false } })- SLSA attestation envelope construction (
externalParameters.workflow,internalParameters.github,runDetails.builder.id) - Canary string
thebeautifulsnadsoftime
- Regexes for
- (Optional) Cross-check on https://socket.dev/npm/package/@antv/g2/overview/5.5.8 — flagged "Known malware".
Version / 版本
🆕 5.x
OS / 操作系统
- [x] macOS
- [ ] Windows
- [ ] Linux
- [ ] Others / 其他
Browser / 浏览器
- [x] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他
Looks like the whole Antv account on github is compromised. Multiple repos have malwares.
Versions after 5.4.8 have been unpublished due to malware infection; the latest installable version is 5.4.8. Other dependent packages may also be deprecated. If a build cache exists, try clearing it and installing a secure version.
See also https://github.com/antvis/.github/pull/14. And here is a full analysis with more details: https://safedep.io/mini-shai-hulud-strikes-again-314-npm-packages-compromised/
I've added this case to https://codeberg.org/DanielRuf/supply-chain-incidents.