Four different rogue packages in the Python Package Index (PyPI) have been found to carry out a number of malicious actions, including dropping malware, deleting the netstat utility, and manipulating the SSH authorized_keys file.
The packages in question are aptx, bingchilling2, httops, and tkint3rs, all of which were collectively downloaded about 450 times before they were taken down. While aptx is an attempt to impersonate Qualcomm’s highly popular audio codec of the same name, httops and tkint3rs are typosquats of https and tkinter, respectively.
“Most of these packages had well thought out names, to purposely confuse people,” security researcher and journalist Ax Sharma said.
An analysis of the malicious code injected in the setup script reveals the presence of an obfuscated Meterpreter payload that’s disguised as “pip,” a legitimate package installer for Python, and which can be leveraged to gain shell access to the infected host.
Also undertaken are steps to remove the netstat command-line utility that’s used for monitoring network configuration and activity as well as modifying the .ssh/authorized_keys file to set up an SSH backdoor for remote access.
“Now this is a sleek but real-world example of damaging malware that successfully made its way into the open-source ecosystem,” Sharma noted.