{"id":"MAL-2026-6421","summary":"Malicious code in leo-cli (npm)","details":"The `leo-cli` npm package was compromised as part of the Miasma worm campaign targeting the LeoPlatform npm ecosystem. On June 24, 2026, 20 LeoPlatform packages were published within a 3-second window by a threat actor who had taken over the npm account `czirker` belonging to the LeoPlatform organization.\n\nThe malicious payload is triggered automatically during `npm install` via a `binding.gyp` file using node-gyp command expansion (`\u003c!(node index.js \u003e /dev/null 2\u003e&1 && echo stub.c)`), which bypasses lifecycle script scanners. The replaced `index.js` (~5.2 MB, obfuscated with ROT-N + AES-128-GCM encryption) deploys a multi-stage worm with the following capabilities:\n\n- Credential theft: Targets npm, GitHub, PyPI, RubyGems, Kubernetes, HashiCorp Vault, AWS (IAM keys, Secrets Manager, IMDS), 1Password, JFrog Artifactory, and SSH keys.\n- AI tool targeting: Exfiltrates configuration files for Claude, Cursor, Gemini, and VS Code.\n- Worm propagation: Enumerates npm packages and auto-publishes version bumps to spread to other maintainers in the ecosystem.\n- GitHub persistence: Creates orphan `snapshot-\u003chex\u003e` branches with fake \"Dependabot Updates\" workflows to maintain access after initial compromise.\n\nAny system that installed this version should be considered fully compromised. Rotate all secrets immediately from a separate, clean machine. See the linked SafeDep report for full payload analysis, indicators of compromise, and remediation guidance.\n\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (520c95e9cea55807cedb7f42a819fdb63febb61fe9a392b3de8f31f129cfa0fc)\nThe package ships a binding.gyp file containing GYP command-expansion syntax (`\u003c!(...)`) in its target configuration. npm implicitly invokes `node-gyp rebuild` whenever a binding.gyp is present — even without an explicit install/postinstall script — and node-gyp evaluates `\u003c!(...)` expressions as shell commands during the configure step. This causes arbitrary shell execution on the installer's machine on `npm install`, functionally equivalent to a lifecycle hook. Additional files (docker/run.js, docker-run.js, lib/build.js, lib/defaultCronRunner.js) combine child_process and outbound HTTP usage, broadening the install/runtime risk surface, though the binding.gyp command-expansion alone is sufficient grounds for installer-side concern.\n\n## Source: ghsa-malware (82a72f819ea5b4241899147f88c47738911bf67d22a3b574c998fd5c5a595a5e)\nAny 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.\n","aliases":["GHSA-hmx8-mh72-wj54"],"modified":"2026-06-25T16:16:23.698486400Z","published":"2026-06-24T23:04:55Z","database_specific":{"malicious-packages-origins":[{"versions":["3.0.3"],"modified_time":"2026-06-25T06:30:26Z","id":"IN-MAL-2026-007465","source":"amazon-inspector","sha256":"520c95e9cea55807cedb7f42a819fdb63febb61fe9a392b3de8f31f129cfa0fc","import_time":"2026-06-25T07:47:50.441351689Z"},{"source":"ghsa-malware","modified_time":"2026-06-25T15:24:16Z","id":"GHSA-hmx8-mh72-wj54","versions":["3.0.3"],"sha256":"82a72f819ea5b4241899147f88c47738911bf67d22a3b574c998fd5c5a595a5e","import_time":"2026-06-25T16:08:55.41489543Z"}],"iocs":{"urls":["https://safedep.io/miasma-worm-hits-leoplatform-20-npm-packages/"]}},"references":[{"type":"ARTICLE","url":"https://safedep.io/miasma-worm-hits-leoplatform-20-npm-packages/"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/leo-cli/v/3.0.3"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-hmx8-mh72-wj54"}],"affected":[{"package":{"name":"leo-cli","ecosystem":"npm","purl":"pkg:npm/leo-cli"},"versions":["3.0.3"],"database_specific":{"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/leo-cli/MAL-2026-6421.json","indicators":{"evidence_files":[{"tlsh":"48c08c3ca9380d1029d958285168d402a4b142a3494e2a81fade60284fa840b2898bad","sha256":"32d1bc728d8e504952083a6adc488c309a401c7df4dc8f47b382ce32e4aebe21","path":"binding.gyp"},{"tlsh":"b0d1a64df79e38be82c93311803d401aedbcdb71075410bcb159fa662694e2843e2fab","sha256":"f02a70a68b5b926c925979ff5999a0df772d992d75e6a6aa44b4c3c59a01d794","path":"docker/run.js"},{"tlsh":"5fc1a98df75f38be82c53311d03e401aed7cdb71065411bcb15dfb5225a8e2953a2e9a","sha256":"34e1780bebd407c5891c601ae6a041c11a8e7553de9c7037bfdef100f4e4668b","path":"docker-run.js"},{"tlsh":"c6c2d6d2b7cd76af4bc0bb85d038400ace6ccaf34551017ebadcb5dc149a95853a9ab8","sha256":"14e14652d4928032436c98ac3d0a1809fde2c375fc29d459c323467b537f8703","path":"lib/build.js"},{"tlsh":"ac1298dd739e36af4bd4674ad0378008beaee2b31a1440fdf54ca754249c62913d9bb4","sha256":"e36fd16de3254fb11556cdeacfc87f22191acd883faf69290b179a6f2581a5ff","path":"lib/defaultCronRunner.js"}],"package_integrity":[{"hashes":{"sha1":"92221eb202e9f2ac577e5c33658c8a05c6d67556","sha512_sri":"sha512-Y7xDzguXR3xMLdQjvomf14kmXOquRYhD3sPa1K9OkolTlBkw2ch/lV0bXgNvBmxk88polXp+GcwBXgNwl1zdCA=="},"filename":"leo-cli-3.0.3.tgz"}]},"cwes":[{"description":"The product contains code that appears to be malicious in nature.","cweId":"CWE-506","name":"Embedded Malicious Code"},{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"},{"description":"The product contains code that appears to be malicious in nature.","cweId":"CWE-506","name":"Embedded Malicious Code"}]}}],"schema_version":"1.7.5","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"},{"name":"SafeDep","contact":["https://safedep.io"],"type":"FINDER"}]}