Hackers Distributing Malicious Python Packages via Popular Developer Q&A Platform

0

In yet another sign that threat actors are always looking out for new ways to trick users into downloading malware, it has come to light that the question-and-answer (Q&A) platform known as Stack Exchange has been abused to direct unsuspecting developers to bogus Python packages capable of draining their cryptocurrency wallets.

“Upon installation, this code would execute automatically, setting in motion a chain of events designed to compromise and control the victim’s systems, while also exfiltrating their data and draining their crypto wallets,” Checkmarx researchers Yehuda Gelb and Tzachi Zornstain said in a report shared with The Hacker News.

The campaign, which began on June 25, 2024, specifically singled out cryptocurrency users involved with Raydium and Solana. The list of rogue packages uncovered as part of the activity is listed below –

The packages have been collectively downloaded 2,082 times. They are no longer available for download from the Python Package Index (PyPI) repository.

The malware concealed within the package served a full-fledged information stealer, casting a wide net of data, including web browser passwords, cookies, and credit card details, cryptocurrency wallets, and information associated with messaging apps like Telegram, Signal, and Session.

It also packed in capabilities to capture screenshots of the system, and search for files containing GitHub recovery codes and BitLocker keys. The gathered information was then compressed and exfiltrated to two different Telegram bots maintained by the threat actor.

Separately, a backdoor component present in the malware granted the attacker persistent remote access to victims’ machines, enabling potential future exploits and long-term compromise.

The attack chain spans multiple stages, with the “raydium” package listing “spl-types” as a dependency in an attempt to conceal the malicious behavior and give users the impression that it was legitimate.

A notable aspect of the campaign is the use of Stack Exchange as a vector to drive adoption by posting ostensibly helpful answers referencing the package in question to developer questions related to performing swap transactions in Raydium using Python.

“By choosing a thread with high visibility — garnering thousands of views—the attacker maximized their potential reach,” the researchers said, adding it was done so to “lend credibility to this package and ensure its widespread adoption.”

While the answer no longer exists on Stack Exchange, The Hacker News found references to “raydium” in another unanswered question posted on the Q&A site dated July 9, 2024: “I have been struggling for nights to get a swap on solana network running in python 3.10.2 installed solana, solders and Raydium but I can’t get it to work,” a user said.

References to “raydium-sdk” have also surfaced in a post titled “How to Buy and Sell Tokens on Raydium using Python: A Step-by-Step Solana Guide” that was shared by a user named SolanaScribe on the social publishing platform Medium on June 29, 2024.

It’s currently not clear when the packages were removed from PyPI, as two other users have responded to the Medium post seeking help from the author about installing “raydium-sdk” as recently as six days ago. Checkmarx told The Hacker News that the post is not the work of the threat actor.

This is not the first time bad actors have resorted to such a malware distribution method. Earlier this May, Sonatype revealed how a package named pytoileur was promoted via another Q&A service called Stack Overflow to facilitate cryptocurrency theft.

If anything, the development is evidence that attackers are leveraging trust in these community-driven platforms to push malware, leading to large-scale supply chain attacks.

“A single compromised developer can inadvertently introduce vulnerabilities into an entire company’s software ecosystem, potentially affecting the whole corporate network,” the researchers said. “This attack serves as a wake-up call for both individuals and organizations to reassess their security strategies.”

The development comes as Fortinet FortiGuard Labs detailed a malicious PyPI package called zlibxjson that packed features to steal sensitive information, such as Discord tokens, cookies saved in Google Chrome, Mozilla Firefox, Brave, and Opera, and stored passwords from the browsers. The library attracted a total of 602 downloads before it was pulled from PyPI.

“These actions can lead to unauthorized access to user accounts and the exfiltration of personal data, clearly classifying the software as malicious,” security researcher Jenna Wang said.

LEAVE A REPLY

Please enter your comment!
Please enter your name here