Skip to main content
MalwarePublished

Recovering a removed npm malware file using Software Heritage and a surviving CDN digest

Source Reddit Malware

0

Discussion

This report details the recovery of a removed npm malware file from the scoped package @goodjavascript/dotenv@1.0.0 using archival sources and CDN metadata. The recovered file contained a timer-based mechanism that collects host information and can execute JavaScript from a server response. The package itself had no installation scripts and an empty exported config function. The recovery was achieved by correlating an older Software Heritage snapshot with a surviving SHA-256 digest from jsDelivr's file manifest. A Python verifier was developed to safely retrieve and hash the file without execution. This analysis supplements an existing OSV advisory and highlights the use of archival tools for malware investigation.

r/Malware (opens in a new tab)u/APT-vs-BellyFAT0 points0 comments

I wrote up my investigation into @goodjavascript/dotenv@1.0.0, including how to recover its entry-point file after the npm tarball and jsDelivr file URLs returned 404.
The useful detail: Software Heritage’s latest snapshot contained only the security placeholder. An older snapshot retained the original release and its 840-byte index.js. Its SHA-256 matched the digest still available in jsDelivr’s file manifest.
Static inspection showed a timer scheduled at module load that collects host information and can execute JavaScript supplied in a server response. The package had no installation scripts, and its exported config() function was empty.
The article includes the package-to-archive discovery steps, dated evidence, an annotated code excerpt and a Python verifier that retrieves and hashes the file without executing it. It also links my analysis contribution to the existing OSV advisory.
https://cgsec.dev/research/dotenv-recovery/
This concerns the scoped @goodjavascript/dotenv package, not the unscoped dotenv package.
Have you used other archives or retained metadata sources to recover removed package evidence?

Links cited in the discussion

References

Community reviews

Loading reviews…