Malicious code in layerd-unit-codec-parser (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (ca65bb450fc2f4d4596fbcc2ddd81af358c2d02f94d965b18e532d8afa62ef5f) The 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.
AI Analysis
Technical Summary
The layerd-unit-codec-parser npm package (version 1.0.0) presents itself as a CSS selector parser but contains a concealed malicious payload. The package includes an approximately 10KB AES-GCM encrypted ciphertext alongside a hardcoded passphrase ('default-dev-passphrase'). At runtime, the ciphertext is decrypted using scrypt-derived keys and base64 decoding, then executed dynamically via new Function with full access to Node.js require and process capabilities. This hidden code execution path is accessible through npm scripts (start, decode, test:cjs) and an undocumented run() function. The package's README does not disclose this behavior, and the API mimics a legitimate selector parser, increasing the likelihood of the malicious code being executed unintentionally. This constitutes a backdoor allowing arbitrary code execution in the context of the host environment.
Potential Impact
If a user installs and runs the layerd-unit-codec-parser package version 1.0.0 and executes the npm start or decode scripts, or calls the run() function, the hidden malicious payload will execute with full Node.js capabilities. This can lead to arbitrary code execution, potentially compromising the host system, stealing data, or performing other malicious actions. The presence of a hardcoded decryption key and encrypted payload bypasses typical source code review defenses, making detection difficult. There are no known exploits in the wild reported at this time.
Mitigation Recommendations
No official patch or remediation is currently available for this malicious package. Users should avoid installing or using layerd-unit-codec-parser version 1.0.0. Since this is a malicious package published to npm, the best mitigation is to remove it from any projects and replace it with a trusted alternative. Monitor package sources carefully and verify package integrity before use. Check the npm registry and vendor advisories for any updates or removals related to this package.
Malicious code in layerd-unit-codec-parser (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (ca65bb450fc2f4d4596fbcc2ddd81af358c2d02f94d965b18e532d8afa62ef5f) The 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.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The layerd-unit-codec-parser npm package (version 1.0.0) presents itself as a CSS selector parser but contains a concealed malicious payload. The package includes an approximately 10KB AES-GCM encrypted ciphertext alongside a hardcoded passphrase ('default-dev-passphrase'). At runtime, the ciphertext is decrypted using scrypt-derived keys and base64 decoding, then executed dynamically via new Function with full access to Node.js require and process capabilities. This hidden code execution path is accessible through npm scripts (start, decode, test:cjs) and an undocumented run() function. The package's README does not disclose this behavior, and the API mimics a legitimate selector parser, increasing the likelihood of the malicious code being executed unintentionally. This constitutes a backdoor allowing arbitrary code execution in the context of the host environment.
Potential Impact
If a user installs and runs the layerd-unit-codec-parser package version 1.0.0 and executes the npm start or decode scripts, or calls the run() function, the hidden malicious payload will execute with full Node.js capabilities. This can lead to arbitrary code execution, potentially compromising the host system, stealing data, or performing other malicious actions. The presence of a hardcoded decryption key and encrypted payload bypasses typical source code review defenses, making detection difficult. There are no known exploits in the wild reported at this time.
Mitigation Recommendations
No official patch or remediation is currently available for this malicious package. Users should avoid installing or using layerd-unit-codec-parser version 1.0.0. Since this is a malicious package published to npm, the best mitigation is to remove it from any projects and replace it with a trusted alternative. Monitor package sources carefully and verify package integrity before use. Check the npm registry and vendor advisories for any updates or removals related to this package.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6578
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a42ed6d27e9c79719938ebf
Added to database: 06/29/2026, 22:10:53 UTC
Last enriched: 07/10/2026, 12:06:32 UTC
Last updated: 07/31/2026, 05:07:30 UTC
Views: 35
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.