Mini Shai-Hulud Hits keyv: Trojanized Release Exfiltrates CI Secrets via GitHub
On August 4, 2026, a malicious version of keyv was published to npm as [email protected], one of a number of npm packages affected across the Keyv and Cacheable ecosystem. The release follows the Mini Shai-Hulud pattern: a trojanized version of a heavily depended-on package, with an install-time hook that reaches cloud and CI credentials. It leaves the compiled library untouched and instead adds a preinstall hook and two files. The second of those files carries names and endpoints for AWS, HashiCorp Vault, Kubernetes, Google Cloud, Azure, npm, and GitHub Actions credentials, batched collection, and repository creation through GitHub’s own API.
Technical analysis
npm install
└─ preinstall hook in package.json
└─ setup.mjs
└─ Math_Symbol.js, run under a downloaded Bun runtime
Figure 1: The entry path, from a dependency install to the bundled file.
What changed
[email protected] differs from [email protected] in three files: package.json, plus additions named setup.mjs and Math_Symbol.js. Nothing under dist/ changed. The compiled library a consumer imports is identical to the previous release.
"files": [
"dist",
"LICENSE",
"setup.mjs",
"Math_Symbol.js"
],
"scripts": {
"build": "tsdown",
"preinstall": "node setup.mjs",
Figure 2: The two entries added to files and the added preinstall hook.
Both edits are load-bearing. The preinstall entry runs before installation completes, so no application code and no import of the library is required. Adding the two filenames to files is what puts them in the tarball, since npm publishes only what files declares.
The consequence for review is that a diff limited to library source shows a clean release, and the move from 6.0.0-rc.1 to 6.0.0 looks like an ordinary promotion to general availability. The version has since been removed from the registry, and the latest tag resolves to 5.6.0.
How it executes
setup.mjs is obfuscated in two layers. Its string literals sit in an array reached through a base64 and RC4 decoder, and its main routine is flattened into a switch statement driven by an encoded order string.
It imports execFileSync from child_process, plus fs, https, os, path, fileURLToPath from url, and zlib. It resolves its own directory from import.meta.url and joins it with the filename Math_Symbol.js to form a path.
Five operations sit in the switch. A download. An unpacking step, which receives the downloaded archive, an entry name and a destination directory. A chmodSync whose mode argument evaluates to 0o755, guarded by the same platform flag that selects between the bun-linux- and bun-window names. An execFileSync against the downloaded binary, passing that path as its only argument with the package directory as the working directory. And an rmSync on the temporary directory inside a finally block.
The temporary directory is named with the prefix bun-dl-, and the download URL is assembled by concatenation. The bun-linux- and bun-window names identify the download as the Bun runtime. The hook already runs under Node, so a second JavaScript engine is not needed to run JavaScript. What the fetched runtime provides is a current and predictable execution environment on any host regardless of the victim’s Node version.
Obfuscation
Math_Symbol.js opens with a // @bun @bun-cjs marker, identifying a Bun-compiled CommonJS bundle, and the whole file is a single line of roughly 727,000 characters. Its strings are held in a 4,613-entry array encoded with basE91 against shuffled 91-character alphabets, of which it contains 71 distinct ones. The array is rotated 14 positions at load, so index references are only correct after rotation. Each decoder holds its alphabet as a local variable and reads its numeric constants from the constant pool rather than inline. No hostname, path or environment variable name appears in readable form anywhere in the file.
What it targets
Math_Symbol.js reaches well past credential files on disk. For AWS it holds the instance metadata and container credential paths, the static and web-identity environment variables, and names for STS caller identity, Secrets Manager retrieval and SSM Parameter Store enumeration. For HashiCorp Vault it holds the token environment variables, the token file path, and names for four separate authentication routes and for KV listing at both v1 and v2. Kubernetes appears as kubeconfig with names for service account token and namespace reads, Google Cloud and Azure as single key names, npm as the registry’s token, identity, organization and OIDC exchange endpoints, and GitHub Actions as the two OIDC request variables.
Collection is batched. Collector start., BATCH_SIZE and flushThresholdBytes sit alongside five [collector] progress and failure strings. One further string, Exiting as russian language detected!, is a host-language check.

