Cloud Security, Malware, DevSecOps

Malicious Python package collects AWS credentials via 37,000 downloads

Python website.

UPDATE

A malicious Python package called "Fabrice" that’s been live on PyPI since 2021 has been typosquatting the popular Fabric SSH automation library, quietly exfiltrating AWS credentials by making more than 37,000 downloads.

The Socket Research Team said in a Nov. 6 post that the legitimate Fabric library has more than 201 million downloads and has earned the trust of developers worldwide. Fabric operates as a high-level Python (2.7, 3.4+) library that executes shell commands remotely over SSH, yielding useful Python objects in return. 

According to the Socket Research Team, Fabrice was designed to exploit this trust: it contains payloads that steal credentials, create backdoors, and execute platform-specific scripts. 

“The Fabrice package represents a sophisticated typosquatting attack, crafted to…exploit unsuspecting developers by gaining unauthorized access to sensitive credentials on both Linux and Windows systems,” wrote the researchers. “Through obfuscated URLs, encoded payloads, and a VPN-based proxy server for covert data exfiltration, this attack underscores the critical importance of using tools that will alert you to this behavior before it lands in your codebase.

The long-term nature of the Fabrice package, which remained active on PyPI for over three years, reflects a calculated, strategic patience often associated with advanced, resourceful threat actors, explained Callie Guenther, senior manager of cyber threat research at Critical Start.

Guenther, an SC Media columnist, said this approach aligns with a trend where attackers prioritize persistent access over immediate impact, likely understanding that collecting AWS credentials over time allows them to gradually build an extensive, high-value data set.

“This collected data can be leveraged for deeper access to target environments, sold to other threat actors, or monetized in phases, maximizing the breach’s longevity and value,” said Guenther. “Typosquatting is an age-old tactic, yet it continues to yield results, especially within the open-source ecosystem where reliance on third-party packages is widespread and often unchecked.”

Guenther added that the intent behind collecting AWS credentials suggests that the attacker either had or anticipated future access to AWS-based infrastructure. AWS credentials offer a pivot-point into cloud-based assets, allowing threat actors not only to exfiltrate data but also to establish secondary backdoors, deploy further payloads, or disrupt operations through data destruction or encryption.

“This focus on cloud credentials indicates an understanding of how critical AWS environments are to the operations of many organizations,” said Guenther. This credential-theft approach points to a calculated, highly valuable attack path.

When a non-human identity (NHI) gets exploited, it’s often just an entry point for attackers to quietly compromise additional identities and assets, said Itzik Alvas, co-founder and CEO at Entro Security. Alvas said while IBM estimates it can take up to a year for companies to identify and mitigate compromised identities in their environments, the “Fabrice” exploit is a good example of how these statistics are only based on the exploits that have been uncovered. 

“There are potentially many undetected multi-year exploits such as this one that lay dormant in various environments, feeding on additional credentials to establish larger payloads without detection,” said Alvas. “This exploit also underscores the necessity of rapidly detecting and responding to abnormal behaviors related to NHIs. Once an attacker’s entered an environment with a compromised NHI it’s only a matter of time before they are able to obtain additional credentials.”

An Amazon spokesperson offered the following advice to security teams:

“We recommend customers who use the legitimate software “fabric” for SSH interactions ensure they are not inadvertently using the malware “fabrice.” AWS customers who suspect malicious activity within their AWS accounts or credentials should follow guidance for remediating potentially compromised AWS credentials or contact AWS Support for assistance. Maintaining proper software supply chain security, including validating the correct source code and name of any software or dependency installed, reduces the risk posed by packages that abuse credentials. AWS contributes to the software supply chain security of Python’s open source ecosystem through an industry first Python Package Index (PyPi) Security Sponsorship with Python Software Foundation."

Editor's Note: This story was updated on Nov. 18 with a statement from AWS.

An In-Depth Guide to Cloud Security

Get essential knowledge and practical strategies to fortify your cloud security.

Get daily email updates

SC Media's daily must-read of the most current and pressing daily news

By clicking the Subscribe button below, you agree to SC Media Terms of Use and Privacy Policy.

You can skip this ad in 5 seconds