creditcard.js@3.0.60
Malicious code in creditcard.js (npm)
Analysis
This version of the credit-card validation library carries a malicious payload in an index.js file that is not part of the package's advertised entry points: the manifest only declares the dist directory, yet index.js is present in the published tarball. index.js contains nothing but a single eval() call whose argument is produced by a Caesar-cipher deobfuscator applied to a large array of character codes. Decoding the cipher reveals an async self-executing function that loads Node's crypto module, defines an AES-128-GCM decryption helper, and uses a hardcoded key, initialization vector, and authentication tag to decrypt a roughly one-megabyte embedded ciphertext blob into a second-stage payload that is then executed in the same context. This is a two-stage, self-decrypting code-execution loader: the letter-shift layer hides the bootstrap and the AES-GCM layer keeps the real payload encrypted to defeat source inspection. A legitimate validation library has no reason to ship hidden, multiply-obfuscated, dynamically-decrypted executable code; the package is a dropper.
- analyzed by
- Leitwacht
- first seen
- Jun 7, 2026, 09:28 PM
- analyzed
- Jun 28, 2026, 06:26 AM
- weekly installs
- 10,691
Related advisories
- creditcard.js@2.1.8 same package
- @immobiliarelabs/backstage-plugin-gitlab@2.1.2
- ai-sdk-ollama@0.13.1
- @immobiliarelabs/backstage-plugin-gitlab@1.0.1
- react-check-error@2.1.6
- chai-assert-kit@3.8.1
- the_tax_free_cashier_is_at_9f@1995.3.20
- webpack-patch@1.1.7
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.