PyPI, or the Python Package Index, is a massive collection of code and applications produced in the Python programming language. As with all large repositories of applications and code, a few bad apples sneak into it unnoticed from time to time. PyPI has malicious apps sneaking onto the platform despite being well-curated.
Researchers found 29 obfuscated Python packages in the PyPI registry that mimic popular libraries but instead drop the W4SP info stealer on infected machines. Other packages use GyruzPIP malware, allegedly created for “educational purposes only.”
- W4SP info stealer retrieves Discord tokens, cookies and saved passwords;
- The GyruzPIP malware is based on the evil-pip open-source project, published “for educational purposes only”. GyruzPIP is designed to steal Chrome passwords, cookies, and Discord tokens and upload all collected data to the Discord webhook.
The packages contain intentional typos in the names to look like well-known Python libraries in the hope that developers trying to find the real library will make a spelling mistake and inadvertently download one of the malicious ones.
Research has shown that this threat injects malicious code into codebases from legitimate libraries. The attack starts by copying existing popular libraries and injecting a malicious “__import__” statement into the package’s healthy codebase.
In the report, the researchers explained in detail the challenges they faced in parsing obfuscated code with more than 71,000 characters.
According to Pepy.tech stats, Phylum researchers report that all packages have been downloaded more than 5,700 times. Additionally, software developer and researcher Hauke Lübbers discovered the PyPI packages “pystile” and “threadings” containing malware disguised as “GyruzPIP”.
The code in these two phishing domains is very simple to parse — each function name says what it does, such as stealing his passwords, browser cookies, and Discord tokens and uploading this data to the webhook Discord.
Lübbers, who has reported these packages to the PyPI maintainer, told BleepingComputer that for these projects to behave maliciously, they might need to be included as dependencies in the program.
PyPI is a software repository for the Python programming language. It is similar to CPAN, Perl’s repository. PyPI assists you in finding and installing software created and shared by the Python community. There are currently over 350,000 Python packages available on PyPI.
List of malicious packages found by Phylum researchers:
This week’s incident is just one of several recent phishing attacks targeting developers using open-source software distribution platforms like PyPI and npm.