Python Packages For PyPi Were Found Emailing Unprotected Websites Using Stolen AWS Keys 

Python Packages For PyPi Were Found Emailing Unprotected Websites Using Stolen AWS Keys 

The PyPI repository has been found to be home to many malicious Python programs that steal sensitive data like AWS credentials and send it to openly accessible locations. Software developers can choose the building blocks for their Python-based applications or share their work with the community via PyPI, a repository of open-source packages. 

PyPI often responds quickly to reports of harmful packages on the platform, but because there is no actual filtering before submission, risky packages may remain there for some time. Using sophisticated automated malware detection methods, software supply-chain security firms like Sonatype were able to distinguish the following packages as dangerous in this instance: 

  • loglib-modules 
  • pyg-modules 
  • pygrata 
  • pygrata-utils 
  • hkg-sol-utils 

All five packages have code connections or similarities, even if the first two try to imitate reputable and well-known projects on PyPI to fool unwary or inexperienced users into installing them. According to Sonatype analysts J. Cardona and C. Fernandez, the programs “loglib-modules” and “pygrata-utils,” were designed to steal environment variables, AWS login credentials, and network interface data. 

It’s interesting to note that “pygrata” requires “pygrata-utils” as a dependency because it lacks data-stealing capabilities. Because of this, even though four malicious packages were swiftly detected and deleted from PyPI, “pygrata” stayed there for a longer period despite its limited autonomy. 

TXT files containing the stolen information are kept on a PyGrata[.]com domain. The endpoint, however, isn’t properly protected. Thus, the analysts could see what the threat actors had taken. The two analysts contacted the domain owners to alert them of the public exposure and ask for answers, acting responsibly and assuming that they could be missing anything. 

Without Sonatype ever receiving a response, the endpoint was quickly made secure from public access. This most likely indicates that these packages’ and the data hosting domain’s genuine purposes aren’t being served. Even if these packages were used for legitimate security testing and the people behind them had no intention of using the stolen information, the fact that they were on PyPI might have put “involuntary participants” in danger if their credentials were eventually made public. 

These malicious programs don’t employ typosquatting techniques. Therefore, they don’t randomly target programmers who entered the wrong character; instead, they target users seeking certain tools for their projects. Software developers are urged to examine package descriptions, download counts, upload dates, homepage URLs, release histories, and upload dates in addition to package names. These factors may all be used to tell if a Python package is authentic or a risky imitation. 

About the author

CIM Team

CIM Team

CyberIntelMag is the trusted authority in cybersecurity, comprised of leading industry experts for over 20 years, dedicated to serving cybersecurity professionals. Our goal is to provide a one-stop shop for knowledge and insight needed to navigate throughout today’s emerging cybersecurity landscape through in-depth coverage of breaking news, tutorials, product reviews, videos and industry influencers.