class-synth (npm) · Malicious Code
Affects class-synthSource GCVE Database
Malicious package : remove class-synth and rotate any secrets on hosts that installed it.
Data as of 15 Jul 2026, 12:36 UTC
Malicious package
Published to npm · OSV MAL-2026-5730
What to do
Remove class-synth from every project, lockfile and image that pulls it in. Treat any host that installed it as compromised: rotate the credentials, tokens and keys it could read, from a clean machine.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmclass-synth | Affected
| Fixed in– |
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (1aa63407d7400b4819d0739dedad0a32d9ae29b18509693c2e8763cf30275271) class-synth is advertised as a small class/style/date utility library, but its main entry (dist/index.js) contains a hidden top-level async IIFE (`__init`) that fires whenever the package is required or imported. The IIFE dynamically imports `node:fs`, `node:path`, `node:child_process`, `node:crypto`, and `node:https` using base64-encoded module names joined at runtime to evade string scanners, and acquires `process` indirectly via `new Function('return typeof process!== "undefined"? process: null;')`. It then recursively walks `process.cwd()` looking for any `.css` file containing an `@sri-hash:` marker, base64-decodes that marker, and AES-256-CBC-decrypts it with a hardcoded key (split across an array of hex chunks `['a7b80b01','7e76fb52','fa527621','f76027d2','19014dfc','a59b49ae','3db97ff3','ab4a72fa']`) to recover an attacker-controlled URL. The decrypted URL is fetched over HTTPS and the response body is piped directly into `child_process.spawn('node', ['-'], {windowsHide: true, stdio: ['pipe','ignore','ignore'], detached: true})`, so attacker-supplied JavaScript executes in the developer/CI Node process with no on-disk artifact, suppressed stdio, and a detached/unref'd child. The bundle is padded with ~750 decoy near-duplicate exports (isWithinBoundary1..200, applyPreset1..150, createSequenceStep1..250, mapOperation1..250, checkConstraint1..250) to bury the dropper near the end of the file. The C2 URL is delivered out-of-band via a planted.css file, which defeats URL-based scanning of the package itself. The combination of base64-hidden Node built-ins, split/encrypted C2 location, indirect process access, detached stdin-piped code execution, and large-scale decoy padding leaves no plausible benign reading. ## Source: ghsa-malware (a96165b209ffb2f4e6ad68ae6bcf380d9c70900d080adafcce9110d4ff5c9b71) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
References
- npmjs.com/package/class-synth/v/1.0.9 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.4 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.6 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.7 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.8 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.3 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.2 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.5 (opens in a new tab)
- github.com/advisories/GHSA-c6cg-h94m-mv67 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.0 (opens in a new tab)
- npmjs.com/package/class-synth/v/1.0.1 (opens in a new tab)