dYdX npm and PyPI Packages Compromised: Wallet Stealers and RAT Malware Deployed in Major Cybersecurity Incident

Critical Security Alert: dYdX npm and PyPI Packages Compromised to Deploy Wallet Stealers and RAT Malware

In a significant cybersecurity incident, researchers have uncovered a sophisticated supply chain attack targeting the dYdX ecosystem. Malicious versions of legitimate packages on both the npm and Python Package Index (PyPI) repositories have been identified, designed to facilitate cryptocurrency wallet credential theft and enable remote code execution.

Details of the Compromised Packages:

– npm Package: `@dydxprotocol/v4-client-js`
– Affected Versions: 3.4.1, 1.22.1, 1.15.2, 1.0.31

– PyPI Package: `dydx-v4-client`
– Affected Version: 1.1.5post1

These packages are integral tools for developers interacting with the dYdX v4 protocol, facilitating operations such as transaction signing, order placement, and wallet management. Given their role in handling sensitive cryptocurrency transactions, the compromise poses a significant risk to users.

Nature of the Malicious Code:

The attack manifests differently across the two ecosystems:

– npm Package: The injected malicious code functions as a cryptocurrency wallet stealer, extracting seed phrases and device information from compromised systems.

– PyPI Package: Beyond the wallet-stealing capabilities, this version incorporates a Remote Access Trojan (RAT). Upon import, the RAT contacts an external server (`dydx.priceoracle[.]site/py`) to fetch and execute commands on the host machine. On Windows platforms, it employs the `CREATE_NO_WINDOW` flag to operate discreetly without displaying a console window.

Method of Compromise:

While the exact method by which these malicious versions were published remains under investigation, initial assessments suggest a compromise of developer accounts. The rogue versions were disseminated using legitimate publishing credentials, indicating that attackers may have gained unauthorized access to the accounts responsible for these packages.

dYdX’s Response:

Upon discovery, dYdX promptly acknowledged the incident and issued guidance to users:

– Immediate Actions for Users:
– Isolate any systems that may have downloaded the compromised packages.
– Transfer funds to new wallets using clean, uncompromised systems.
– Rotate all API keys and credentials to prevent unauthorized access.

dYdX also clarified that the versions of `dydx-v4-clients` hosted on their official GitHub repository remain unaffected and do not contain the malicious code.

Historical Context:

This incident is not isolated within the dYdX ecosystem. In September 2022, a similar supply chain attack occurred when an npm account belonging to a dYdX staff member was hijacked. The attackers published new versions of multiple npm packages containing code designed to steal credentials and other sensitive data. Additionally, in 2024, the dYdX v3 platform’s website was compromised through a DNS hijacking attack, redirecting users to a phishing site aimed at draining their wallets.

Broader Implications:

This attack underscores the escalating sophistication of supply chain threats within the software development community. By compromising trusted open-source repositories, malicious actors can infiltrate numerous systems simultaneously, exploiting the inherent trust developers place in these platforms.

Recommendations for Developers:

To mitigate the risks associated with such supply chain attacks, developers are advised to:

1. Verify Package Integrity: Regularly check the authenticity and integrity of packages before integration.

2. Monitor Dependencies: Stay vigilant about the dependencies used in projects, ensuring they are sourced from reputable and secure channels.

3. Implement Multi-Factor Authentication (MFA): Enhance account security by enabling MFA on all developer accounts to prevent unauthorized access.

4. Stay Informed: Keep abreast of security advisories and updates from package maintainers and the broader developer community.

Conclusion:

The recent compromise of dYdX’s npm and PyPI packages serves as a stark reminder of the vulnerabilities inherent in the software supply chain. As attackers continue to refine their methods, it is imperative for developers and organizations to adopt proactive security measures, ensuring the integrity of their development environments and the safety of end-users.