Malicious code in hd-key-generator (npm)
The hd-key-generator npm package is a malicious typosquat of the legitimate hdkey package. Upon being required, it collects extensive environment information including environment variables, hostname, username, home directory, platform, current working directory, and package metadata. This data is serialized, encoded, and sent via an HTTPS GET request to a hardcoded Telegram Bot API endpoint, potentially exposing sensitive secrets such as AWS credentials, GitHub tokens, and database credentials. The package attempts to maintain the appearance of normal functionality by re-exporting the real hdkey package if it is installed, or providing stub functions otherwise. Only version 1.6.3 of hd-key-generator is known to be affected. There is no CVSS score or known exploits in the wild reported for this threat.
AI Analysis
Technical Summary
hd-key-generator is a malicious npm package designed as a typosquat of the legitimate hdkey package. When loaded, it harvests sensitive environment data including process environment variables, system hostname, user information, home directory, platform, current working directory, and package metadata. This information is serialized to JSON, base64-encoded, and exfiltrated via an HTTPS GET request to a Telegram Bot API endpoint controlled by the attacker. A temporary marker file prevents repeated data exfiltration. To avoid detection, if the legitimate hdkey package is present, hd-key-generator re-exports it to preserve expected functionality; otherwise, it returns stub functions. This behavior allows the attacker to collect secrets from the environment of the user or CI system installing the package. The affected version is exactly 1.6.3.
Potential Impact
The malicious package can exfiltrate sensitive environment data including secrets such as AWS credentials, GitHub tokens, NPM tokens, and database credentials. This can lead to credential compromise and unauthorized access to cloud services, source code repositories, and databases. The attacker gains access to environment details that may facilitate further attacks or lateral movement. The package masquerades as a legitimate dependency, increasing the risk of inadvertent installation and data leakage.
Mitigation Recommendations
No official patch or remediation is provided for hd-key-generator as it is a malicious typosquat package. The best mitigation is to avoid installing this package and instead use the legitimate hdkey package. Users and organizations should audit their dependencies to detect and remove hd-key-generator version 1.6.3 if present. Employing strict package name verification and using package integrity checks can help prevent typosquatting attacks. Monitor for any unexpected network traffic to Telegram Bot API endpoints from build or runtime environments.
Malicious code in hd-key-generator (npm)
Description
The hd-key-generator npm package is a malicious typosquat of the legitimate hdkey package. Upon being required, it collects extensive environment information including environment variables, hostname, username, home directory, platform, current working directory, and package metadata. This data is serialized, encoded, and sent via an HTTPS GET request to a hardcoded Telegram Bot API endpoint, potentially exposing sensitive secrets such as AWS credentials, GitHub tokens, and database credentials. The package attempts to maintain the appearance of normal functionality by re-exporting the real hdkey package if it is installed, or providing stub functions otherwise. Only version 1.6.3 of hd-key-generator is known to be affected. There is no CVSS score or known exploits in the wild reported for this threat.
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
hd-key-generator is a malicious npm package designed as a typosquat of the legitimate hdkey package. When loaded, it harvests sensitive environment data including process environment variables, system hostname, user information, home directory, platform, current working directory, and package metadata. This information is serialized to JSON, base64-encoded, and exfiltrated via an HTTPS GET request to a Telegram Bot API endpoint controlled by the attacker. A temporary marker file prevents repeated data exfiltration. To avoid detection, if the legitimate hdkey package is present, hd-key-generator re-exports it to preserve expected functionality; otherwise, it returns stub functions. This behavior allows the attacker to collect secrets from the environment of the user or CI system installing the package. The affected version is exactly 1.6.3.
Potential Impact
The malicious package can exfiltrate sensitive environment data including secrets such as AWS credentials, GitHub tokens, NPM tokens, and database credentials. This can lead to credential compromise and unauthorized access to cloud services, source code repositories, and databases. The attacker gains access to environment details that may facilitate further attacks or lateral movement. The package masquerades as a legitimate dependency, increasing the risk of inadvertent installation and data leakage.
Mitigation Recommendations
No official patch or remediation is provided for hd-key-generator as it is a malicious typosquat package. The best mitigation is to avoid installing this package and instead use the legitimate hdkey package. Users and organizations should audit their dependencies to detect and remove hd-key-generator version 1.6.3 if present. Employing strict package name verification and using package integrity checks can help prevent typosquatting attacks. Monitor for any unexpected network traffic to Telegram Bot API endpoints from build or runtime environments.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-13345
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["npm"]
Threat ID: 6a73851fbf8831d5394ef8df
Added to database: 08/05/2026, 18:46:55 UTC
Last enriched: 08/05/2026, 23:01:23 UTC
Last updated: 09/16/2026, 14:36:23 UTC
Views: 20
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.
External Links
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.