creditcard.js@2.1.8
Malicious code in creditcard.js (npm)
Analysis
This is a compromised/trojanized build of the popular creditcard.js credit-card validation library. The legitimate package ships only its dist/ bundle, but this version adds an extra package-root index.js containing a heavily obfuscated payload. The payload is hidden behind two layers of obfuscation: an outer Caesar-cipher decoder fed a roughly 600k-element character-code array, and inner AES-128-GCM-encrypted blobs decrypted at load time with hardcoded keys and IVs via node:crypto. Once decoded, the payload uses node:child_process to silently download the Bun JavaScript runtime from a GitHub releases URL (curl), unzip it into a temporary directory, and chmod it executable. This stages a separate runtime so a follow-on payload can run outside Node, bypassing Node-based security tooling. None of this behaviour relates to credit-card validation; it is an obfuscated dropper injected into a trusted package name.
- analyzed by
- Leitwacht
- first seen
- Jun 7, 2026, 09:27 PM
- analyzed
- Jun 28, 2026, 06:10 AM
- weekly installs
- 10,691
Related advisories
- creditcard.js@3.0.60 same package
- 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
- wao@0.41.2
- stylelint-standard@1.2.0
- macos-ci-utils@1.0.1
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.