date-fns-formatter
Affected
- introduced
0(semver)
Fixed versions
None listed
Fix
No fixed version is listed.
Advisory
Also known as: GHSA-h258-m2gc-2p4q
Malicious package Its source marks this package as malicious: it is not a vulnerability in a legitimate one.
Malicious code in date-fns-formatter (npm)
---
_-= Per source details. Do not edit below this line.=-_
Source: amazon-inspector (e9839e9520db45a2a739a415767a8258e15afee65cee71fe5ff41777cbd22450)
The package impersonates the popular date-fns library. Its main module, date-fns-formatter.js, contains a small formatDate shim as a decoy in front of a heavily obfuscated IIFE (obfuscator.io-style rotated string array with a runtime decoder) that runs whenever the module is required. The IIFE creates a hidden directory under os.homedir(), writes a package.json declaring axios, better-sqlite3, node-machine-id, and socket.io-client (plus ffi-napi on Windows), invokes npm install (via npm.cmd through cmd.exe on Windows) to fetch those dependencies, decodes and writes a second obfuscated script (main.js) reassembled from a ~200-piece string array containing base64-encoded https:// URL fragments, and spawns node main.js. On Windows a.vbs wrapper is written that uses WScript.Shell.Run(..., 0, False) to launch the second stage hidden and detached. The provisioned second stage (socket.io-client + node-machine-id + ffi-napi) is a persistent WebSocket remote-agent keyed by a stable host fingerprint, enabling remote command execution on the installer's host. The manifest also self-references date-fns-formatter as its own dependency, and the README example is nonsensical, consistent with a cover-story typosquat rather than a broken legitimate package.
Source: ghsa-malware (4697d7421598f74c2fab37872abece4c92699f612f6b4e54c7eb6c5a1b51d7c1)
Any 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.
Not rated by the source.
0 (semver)None listed
No fixed version is listed.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: OpenSSF Malicious Packages · Apache-2.0