"PyPI Served Malicious Version of Popular 'Ctx' Python Package"

Researchers at Sonatype, SANS Institute, and an independent researcher have discovered that a popular Python package was compromised recently and replaced with a malicious version designed to help the attacker obtain AWS credentials.  The researchers stated that two libraries appear to have been targeted in the attack, but only one of them may have had a more significant impact.  The Python package named Ctx, which has, on average, 22,000 downloads per week, was compromised on the Python Package Index (PyPI) on May 14.  The last Ctx update prior to this attack was uploaded to PyPI in December 2014, but new versions were published on and after May 14.  The investigation by the researchers revealed that the original maintainer’s domain name expired, and the attacker registered the domain on May 14.  With access to the domain, they could have created an email address to which the password reset link would be sent.  The Ctx versions uploaded by the attacker, 0.1.2 (this was also the last version of the original), 0.2.2, and 0.2.6 included functionality to steal data and upload it to a remote location controlled by the attacker.  The researchers noted that targeted data in one version included AWS access key ID, computer name, and AWS secret access key when a dictionary is created.  Another malicious version of Ctx targeted all environment variables.  The second compromised library discovered by the researchers was the PHPass portable PHP password hashing framework.  The original PHPass was deleted in September 2021, along with its original developer’s account.  The developer’s username became available, and it was claimed by the attacker, giving them access to the project’s GitHub account.  The researchers noted that both impacted libraries have been taken down.  While the malicious Ctx version may have impacted many users, PHPass appears to have had only a handful of installations in recent weeks.  The researchers saw evidence that suggested the two incidents are related.  

 

SecurityWeek reports: "PyPI Served Malicious Version of Popular 'Ctx' Python Package"

Submitted by Anonymous on