Malicious code in totp-utils (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (8cebaa0a3370c12104ef2816420193171f431df0d113fdc5d8c9f1dc921deeb5) Package advertises itself as a TOTP utility but its postinstall script (`node./index.js --setup 2>/dev/null || true`) and its exported `validateSecret` API both invoke a hidden `_run()` routine that (1) scans Discord/Chrome/Edge/Brave/Opera LevelDB stores under `os.homedir()` for Discord auth-token regexes, DPAPI-decrypts encrypted tokens via a spawned powershell `ProtectedData.Unprotect` call, parses Minecraft launcher credentials (vanilla `launcher_accounts.json`, Lunar `accounts.json`, ModrinthApp `app.db` JWTs), validates the harvested Discord tokens against `discord.com/api/v9`, and POSTs the collected credentials to a hardcoded Discord webhook whose URL is stored as chunked base64 in `_x` and reassembled at runtime (`Buffer.from(_x.join(''),'base64')`) to a `discord.com/api/webhooks/1532429233769419004/...` endpoint; and (2) enumerates vanilla/Modrinth/Lunar Minecraft profile `mods/` directories and writes an opaque JAR named `optimized-renderer-1.0.0.jar` (URL also stored as chunked base64 decoding to `cdn.discordapp.com/attachments/1507484731535785994/1540335670831222894/optimized-renderer-1.0.0.jar`) into each discovered mods folder, delivering unverified code that will execute the next time the user launches Minecraft with a Fabric loader. The postinstall suppresses stderr and uses a 4-second `setTimeout` to appear to finish cleanly. Because `validateSecret` (part of the three-function public API) schedules `_run()` via `setImmediate`, the same theft and dropper also fire whenever a downstream consumer imports the package and calls the advertised TOTP function — extending the attack surface well beyond install time. ## Source: ghsa-malware (145fefb1ae148805aea6871e4815b86fb21f89d31230787f8a9a5eb8e5a1cea2) 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. ## Source: ossf-package-analysis (9c45116c29a00a054ccdbbef39b740b4551b671bdb999a0c8d76deac16b9352e) The OpenSSF Package Analysis project identified 'totp-utils' @ 1.4.4 (npm) as malicious. It is considered malicious because: - The package communicates with a domain associated with malicious activity.
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 totp-utils npm package versions 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, and 1.4.9 include a postinstall script and a validateSecret API that invoke a hidden _run() routine. This routine scans LevelDB stores for Discord authentication tokens, decrypts them using Windows DPAPI via PowerShell, parses Minecraft launcher credentials from multiple sources, validates Discord tokens against the Discord API, and exfiltrates harvested credentials to a hardcoded Discord webhook URL reconstructed at runtime. It also enumerates Minecraft mods directories and writes a malicious JAR file named optimized-renderer-1.0.0.jar from a Discord CDN URL into each mods folder, which executes when Minecraft is launched with Fabric loader. The postinstall script suppresses errors and delays completion to avoid detection. The malicious code activates both during installation and whenever the validateSecret function is called, increasing the risk of credential theft and remote code execution.
Potential Impact
This malicious package compromises user security by stealing sensitive Discord authentication tokens and Minecraft credentials, potentially allowing attackers to hijack user accounts. The dropped malicious JAR file enables execution of unverified code within the Minecraft environment, posing a risk of remote code execution on the victim's system. The stealthy nature of the postinstall script and runtime activation of the malicious routine increase the likelihood of unnoticed compromise.
Mitigation Recommendations
No official patch or remediation guidance is provided in the available data. Users should immediately remove all affected versions of the totp-utils package (=1.4.2, =1.4.3, =1.4.4, =1.4.5, =1.4.6, =1.4.7, =1.4.8, =1.4.9) from their environments. Avoid using this package and audit systems for the presence of the malicious optimized-renderer-1.0.0.jar file in Minecraft mods directories. Rotate any potentially compromised Discord and Minecraft credentials. Monitor for suspicious activity related to these accounts. Check vendor advisories or npm security advisories for updates or official fixes.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-14379
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["npm"]
Threat ID: 6a8af9a3acd9273b49f32ecf
Added to database: 08/23/2026, 13:46:11 UTC
Last enriched: 08/23/2026, 13:48:41 UTC
Last updated: 10/02/2026, 14:14:28 UTC
Views: 28
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.
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.