A malicious package named “fabrice” has been found on the Python Package Index (PyPI), exploiting a popular typosquatting tactic to steal AWS credentials from developers. The package closely mimics “fabric,” a trusted Python library used for automating shell commands over SSH. Published in March 2021, the “fabrice” package has been downloaded over 37,100 times, deceiving developers into installing it. The legitimate “fabric” library has accumulated over 202 million downloads, providing the perfect cover for the malicious version. Despite its malicious nature, the “fabrice” package remains available on PyPI at the time of discovery.
Designed to target both Linux and Windows systems, “fabrice” deploys different payloads based on the operating system it is executed on. For Linux users, the package downloads, decodes, and executes several shell scripts from a remote server, establishing a foothold on the system. In contrast, Windows systems are targeted with two separate payloads: a Visual Basic Script and a Python script. The Visual Basic Script serves as a launcher, running a hidden Python script that downloads further malicious executables and sets up persistence. These payloads ensure the malware remains active on the infected system, even after rebooting.
The ultimate goal of the “fabrice” package is credential theft. The package uses the Boto3 AWS Software Development Kit (SDK) for Python to gather AWS access and secret keys from the infected system. These stolen credentials are then exfiltrated to an external server controlled by the attacker. By obtaining these keys, the attacker can access sensitive cloud resources, potentially leading to significant security breaches for affected organizations. The use of AWS credentials also opens the door to further exploitation of the compromised cloud infrastructure.
This attack highlights the growing threat of typosquatting in the developer community, where attackers exploit the trust developers place in well-known libraries. The “fabrice” package is a sophisticated example of how malicious actors can take advantage of subtle naming differences to infect systems and steal sensitive data. As developers increasingly rely on third-party libraries, it is crucial to verify package sources and stay vigilant against such attacks. The discovery of “fabrice” serves as a reminder of the importance of securing development environments and exercising caution when using external dependencies.