MAL-2026-6578Malicious code in layerd-unit-codec-parser (npm)
| Ecosystem | Package | Version |
|---|---|---|
| npm | layerd-unit-codec-parser | * |
| npm | layerd-unit-codec-parser | 1.0.0 |
| npm | layerd-unit-codec-parser | 2.0.0 |
{"schema_version":"1.7.4","id":"MAL-2026-6578","published":"2026-06-29T06:35:34Z","modified":"2026-08-20T14:28:59.936264501Z","aliases":["GHSA-3h97-jj75-q7j4"],"summary":"Malicious code in layerd-unit-codec-parser (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (ca65bb450fc2f4d4596fbcc2ddd81af358c2d02f94d965b18e532d8afa62ef5f)\nThe package presents itself as a CSS selector parser (src/selector-parser.js re-exports postcss-selector-parser; keywords postcss/selector/parser/css), but its main module also exposes run / runDefaultDecodedFunction / finalFinalDecodeAndRun. src/config/defaults.js ships an ~10KB opaque AES-GCM ciphertext (DEFAULT_FINAL_ENCODED_TEXT) alongside a hardcoded passphrase (\"default-dev-passphrase\"); src/aes/aes-gcm.js uses base64 Buffer decoding and scrypt to derive the key, decrypts the blob, and src/pipeline/custom-codec-pipeline.js invokes the plaintext as code through new Function(\"require\", runnable)(require), granting the smuggled bytes full Node require/process capabilities. The package's own runtime/lib.min.js calls require(\"../src\").run(), and package.json scripts (start, decode, test:cjs) plus a root cjs-runner.js funnel into the same decrypt-and-execute path. None of this is documented in the README, which describes only selector parsing and encode/decode helpers. A consumer who installs the package and runs the advertised npm start / decode scripts, or who imports and calls run(), executes the hidden payload. The combination of an opaque encrypted executable shipped in the tarball, a hardcoded key that makes the ciphertext functionally equivalent to shipping the code while evading source review, and an undocumented entry point that invokes it with full Node capabilities is a backdoor pattern. The postcss-selector-parser API mimicry increases the chance of the hidden run() path being reached.\n\n## Source: ghsa-malware (a528d47bc1d6d0ca165042a753200e57a91c67c67fc9bf9e50cfe081af638b42)\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","affected":[{"package":{"name":"layerd-unit-codec-parser","ecosystem":"npm"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}],"versions":["1.0.0","2.0.0"],"database_specific":{"cwes":[{"cweId":"CWE-506","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.","name":"Embedded Malicious Code"},{"cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code"}],"indicators":{"evidence_files":[{"path":"src/pipeline/custom-codec-pipeline.js","sha256":"6a38f4170e8e82254423040d311c8164b3d928ebc00cd7a95a8f22bee75ce128","tlsh":"367130c23cbf79c71d9bed64f0af0869186ca7113505f268aca953c80aeb275d123c8d"},{"path":"src/config/defaults.js","sha256":"7fa23efa8dd21f8cc971ec80173883fb5ae8b938af2f3361c54e1a6aea37792b","tlsh":"c742bf832e9aeb5d04bcad5c503bab6309408f7bee7875c68ccd10e9b88d953057149e"},{"path":"README.md","sha256":"748cb0cc0278416ca780ff47c4b6b7b5702341a6bae967014b8808b11309d7f6","tlsh":"1341e091797203f02a2f09a72d0da856e95ed4df7144e8c16c6c9be52f851c61b170bf"}],"package_integrity":[{"filename":"layerd-unit-codec-parser-1.0.0.tgz","hashes":{"sha1":"edfc09cd61484982b38152df96007d2f27808dac","sha512_sri":"sha512-e0IAZaFV3XQmbNHpvel1QaA6xqoUhlxqtBc3lCKHpNdtIUbXWreMNH/NChBZXPfS5wF6uICCbDrKiyQNSHAk4w=="}}]}}}],"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/layerd-unit-codec-parser/v/1.0.0"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/layerd-unit-codec-parser/v/2.0.0"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-3h97-jj75-q7j4"}],"database_specific":{"malicious-packages-origins":[{"id":"IN-MAL-2026-007767","import_time":"2026-06-29T07:09:11.126829777Z","modified_time":"2026-06-29T06:35:34Z","ranges":[{"events":[{"introduced":"0"}],"type":"SEMVER"}],"sha256":"e27d4511e4a3f335712736eebef6cf8e55e3f1bccbb13ded2fcef675622e58e1","source":"amazon-inspector","versions":["1.0.0"]},{"id":"IN-MAL-2026-009565","import_time":"2026-07-09T22:56:34.860271339Z","modified_time":"2026-07-09T22:14:18Z","sha256":"ca65bb450fc2f4d4596fbcc2ddd81af358c2d02f94d965b18e532d8afa62ef5f","source":"amazon-inspector","versions":["2.0.0"]},{"id":"GHSA-3h97-jj75-q7j4","import_time":"2026-08-20T14:26:11.970287483Z","modified_time":"2026-08-20T13:57:30Z","ranges":[{"events":[{"introduced":"0"}],"type":"SEMVER"}],"sha256":"a528d47bc1d6d0ca165042a753200e57a91c67c67fc9bf9e50cfe081af638b42","source":"ghsa-malware"}]},"credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}数据来源:OpenSSF Malicious Packages · Apache-2.0