G2 icon indicating copy to clipboard operation
G2 copied to clipboard

[SECURITY] @antv/g2 5.5.8 is a malicious release — maintainer compromise, credential stealer in preinstall script (please yank & rotate npm tokens)

Open askasmani opened this issue 6 months ago • 4 comments

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:

  1. index.js (498,431 bytes) — heavily obfuscated (obfuscator.io string-array style) malicious payload.
  2. package.json has two extra fields not present in upstream master:
    "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 / 重现步骤

  1. Fetch the tarball directly (do NOT install): curl -O https://registry.npmjs.org/@antv/g2/-/g2-5.5.8.tgz
  2. Verify SHA-256: sha256sum g2-5.5.8.tgz → 1f9bb122788e582369731c91c9de13f6f69c37435ca93d487fa6b38178cc0dd7
  3. Extract with tar only (this does not invoke npm lifecycle scripts): mkdir x && tar -xzf g2-5.5.8.tgz -C x
  4. Compare against the official v5.5.7 git tag / tarball:
    • Extra file: package/index.js (498,431 bytes, obfuscator.io output).
    • package/package.json has an added "preinstall": "bun run index.js" script.
    • package/package.json has an added optionalDependencies."@antv/setup" pointing to a pinned GitHub commit on antvis/G2.
  5. 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
  6. (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 / 其他

askasmani avatar May 19 '26 03:05 askasmani

Looks like the whole Antv account on github is compromised. Multiple repos have malwares.

askasmani avatar May 19 '26 03:05 askasmani

Image

rockyzzz045 avatar May 19 '26 05:05 rockyzzz045

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.

moayuisuda avatar May 19 '26 05:05 moayuisuda

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.

DanielRuf avatar May 19 '26 08:05 DanielRuf