North Korean Hackers Exploit NPM Packages to Steal cryptocurrency and Sensitive Data

North Korean Hackers Exploit NPM Packages to Steal cryptocurrency and Sensitive Data

Veracode Threat Research has uncovered a sophisticated North Korean cryptocurrency theft operation that continues to evolve, building on campaigns previously reported in February and June 2024.

This latest iteration involves twelve malicious NPM packages, including cloud-binary, json-cookie-csv, cloudmedia, and nodemailer-enhancer, which were flagged by automated monitoring systems and subsequently removed from the NPM registry.

The attackers, suspected to be state-sponsored actors aiming to fund sanctioned activities, impersonate recruiters offering fake developer jobs.

During simulated interviews, victims are tricked into installing these packages as part of coding exercises, such as running unit tests that execute hidden malware.

This tactic exploits trust in the hiring process to deploy payloads that exfiltrate cryptocurrency wallet data, browser extension credentials, and other sensitive files from developers’ machines, potentially enabling corporate network breaches.

 typosquat on the cloudinary NPM package

Targets Developers Through Fake Job Interviews

The malware, identified as variants of the Beavertail family, employs advanced obfuscation and encryption techniques, with payloads often hidden in innocuous files like licenses or analytics scripts.

For instance, in cloud-binary (a typosquat of the legitimate cloudinary package), a postinstall hook triggers a detached process that decrypts an AES-256 encrypted payload using a fixed key and IV, revealing obfuscated JavaScript.

This code supports cross-platform operations on Windows, macOS, and Linux, enumerating system details like OS type, username, and platform before searching for crypto-related browser extensions (e.g., MetaMask, Phantom) by their IDs.

It collects and exfiltrates files such as .log and .ldb databases containing private keys and seed phrases, alongside documents, PDFs, screenshots, and macOS Keychain data.

Additional features include downloading second-stage payloads via curl from command-and-control (C2) servers, executing arbitrary Python scripts fetched from endpoints like http://144.172.105.235:1224/client/5346/324, and establishing WebSocket connections for remote shell command execution.

Investigations revealed code similarities across packages, such as the creation of a ~/.n3 directory, suggesting this is version 3 of the malware.

Encryption keys and C2 infrastructure, including ports like 1224, are reused, linking these to prior attacks.

Variants differ in complexity: some, like nodemailer-enhancer, hide payloads in hex-encoded license files decrypted with high-entropy keys, while others like json-cookie-csv incorporate backup C2 servers and axios requests to fetch additional obfuscated JavaScript from endpoints like https://api.npoint.io/e5a5e32cdf9bfe7d2386, which includes campaign flags.

Intriguingly, some payloads contain taunting messages, hinting at possible involvement of multiple actors or internal rivalries. Veracode’s Package Firewall blocked most packages preemptively, and notifications to NPM ensured their removal.

This campaign underscores the risks in open-source ecosystems, where attackers leverage supply-chain vulnerabilities to target high-value assets like crypto holdings and corporate secrets.

Indicators of Compromise (IOCs)

Indicator Description
http://144.172.105.235:1224 C2 #1
http://45.61.128.61:1224 C2 #2
http://144.172.106.7:1224 C2 #3
http://144.172.109.98:1224 C2 #4
http://144.172.104.10:1224 C2 #5
http://45.61.165.45:1224 C2 #6
http://45.61.150.67:1224 C2 backup
http://135.181.123.177 C2 WebSocket #1
http://95.216.46.218 C2 WebSocket #2
https://api.npoint.io/e5a5e32cdf9bfe7d2386 C2 axios request
f11e5d193372b6986b7333c0367ed2311f7352b94b079220523384a3298f5e87 SHA256 hash of decrypted cloud-binary and cloudmedia payload

Find this News Interesting! Follow us on Google News, LinkedIn, and X to Get Instant Updates!


Source link