Sunday, November 24, 2024

Citrine Sleet Poisons PyPI Packages With Mac & Linux Malware

One of North Korea’s most sophisticated threat groups has been hiding remote access malware for macOS and Linux inside of open source Python packages.

North Korean advanced persistent threats (APTs) have become notorious for certain characteristic types of cyberattack in recent years. There’s the cryptocurrency scam, which can come in many forms — often a fake trading platform, where victims are lured into divulging their wallet information or downloading malware. Supply chain attacks are common, particularly via poisoned packages typosquatting on public repositories. An impish recent trend involves contracting actual, honest labor to Western companies under false pretenses, then sending the salaries earned back to Kim’s state. The reverse — agents posing as tech recruiters, convincing developers to download malware — is also common.

The group, which Palo Alto’s Unit 42 tracks as Gleaming Pisces (and Microsoft as Citrine Sleet), seems to have supplemented category one with category two. Active since 2018, the financially motivated, DPRK Reconnaissance General Bureau (RGB)-linked group is known for attacks weaponizing fake crypto platforms. Unit 42 now assesses with medium confidence that it was responsible for uploading a handful of malicious packages to the Python Package Index (PyPI) back in February. The packages have since been taken down.

DPRK-Poisoned PyPI Packages

Most packages uploaded to open source repositories are simple by nature. As Louis Lang, co-founder and chief technology officer (CTO) at Phylum recalls, “What was interesting about these packages was that there was a higher order of complexity than you typically find among benign packages.”

Phylum had identified four packages worth taking a second look at: real-ids, minisound, coloredtxt, and beautifultext. The innocuous names seemed to allude to legitimate functionality, like syntax highlighting for terminal outputs.

In reality, the packages contained malicious code that would be decoded and executed upon download. The code would then run bash commands in order to retrieve and download a remote access Trojan (RAT) called “PondRAT.”

PondRAT is an entirely simple backdoor, capable of just a few functions: uploading and downloading files, checking to see that an implant is active or instructing it to sleep, and executing commands issued by the operator. It is, in essence, a “light” version of PoolRAT. PoolRAT is a known Gleaming Pisces backdoor for macOS that has a half dozen more standard capabilities than its successor, like listing directories, deleting files, etc.

No Need for Windows

More notable than the malware itself may be the fact that its authors wrote it only for macOS and Linux systems.

Forgoing hackers’ long preferred Windows operating system makes sense, though, when one considers Gleaming Pisces’ typical audience. As Lang explains, “They’re targeting the actual builders, CI/CD infrastructure, developer workstations — environments that are overwhelmingly going to be Linux or macOS based. Very few people are doing development on straight Windows. So if you are targeting developers, it makes sense to ship variants for these systems, because that’s where your target population lives.”

Developers, then, need to be alert to phishing attacks, like those fake crypto platforms and job recruitment scams. Because while it’s rare that anyone might pull an unpopular, ultra-generic package from PyPI, it’s entirely likely that that same package could be quietly integrated into a broader infection chain.

“If you add a package, it could have downstream impacts, where you’re actually pulling in 30, 40 other packages it may [be connected to]. So if I was a developer, I’d be very cognizant of what I’m installing, and try to minimize the attack surface by minimizing the number packages I’m pulling in. And then, obviously, scan the packages — look for these zombies, look for high-entropy strings, look for code obfuscation,” Lang suggests.

“Like we always say,” he adds, “you’re one update away from malware.”


Related Articles

Latest Articles