Skip to content

Malicious 'pymafka' Package Spreads Cobalt Strike Beacons via PyPI

Be cautious when installing Python packages. This one spread malware via a fake library, infecting hundreds of systems.

In the image there is a bug on the white surface.
In the image there is a bug on the white surface.

Malicious 'pymafka' Package Spreads Cobalt Strike Beacons via PyPI

A malicious Python package, 'pymafka', has been discovered on the PyPI registry. It's a typosquat of the legitimate 'PyKafka' library, downloaded over 4 million times. The package has been used to spread Cobalt Strike beacons, with around 300 infections before its removal.

The 'pymafka' package contains a 'setup.py' script that downloads and executes a Cobalt Strike beacon on infected systems, depending on the user's operating system. On Windows, the beacon is dropped at 'C:UsersPubliciexplorer.exe', mimicking the legitimate 'iexplore.exe' process. The beacon attempts to contact the China-based IP 39.106.227[.]92, assigned to Alibaba (Alisoft).

The malicious executables 'win.exe' and 'MacOS' are downloaded from the IP address 141.164.58[.]147, commissioned by Vultr. The package was investigated and reported by Moonlock Lab, the cybersecurity division of MacPaw. It was discovered by Sonatype's automated malware detection bots and taken down after Sonatype reported it to PyPI, preventing further downloads.

The 'pymafka' package has been removed from PyPI, but it had been downloaded around 300 times before its removal. Users are advised to be cautious when installing Python packages and to stick to well-known, trusted sources. The investigation into the creators of 'pymafka' is ongoing.

Read also:

Latest