Over 170K users caught up in poisoned Python package ruse
- Reference: 1711389609
- News link: https://www.theregister.co.uk/2024/03/25/python_package_malware/
- Source link:
According to [1]CheckMarx , members of the Top.gg GitHub organization as well as other developers were targeted, and it all hinged on various supply chain attack techniques to distribute malware-infected Python PyPI packages.
That malware stole data from people's browsers, Discord (the chat app of choice for Top.gg members), crypto wallets, and files that matched certain keywords. As of now, it's not clear where this data was sent.
[2]
There were multiple prongs to this remarkably complicated attack: clones of popular Python packages such as Colorama, a doppelganger or typosquatted domain for Python packages, and code obfuscation. Also reported are account break-ins across trusted GitHub community members. All of these tactics were used to successfully steal user data from an undetermined number of developers.
[3]
[4]
The malicious Python packages were uploaded in November 2022, but the attack didn't start in earnest until last February when the doppelganger domain was registered. The official PyPI domain is pythonhosted.org, though the similar pypihosted domain (now taken down by Cloudflare) was available and the attacker registered it. The attacker made sure that real URL and the fake URL strings looked nearly identical. In fact, the only difference between the two was the domain name, pythonhosted versus pypihosted.
The fake Python package website hosted the popular tool Colorama with some malware added on. The code is actually just a short line that's been appended to the second line but with tons of spaces so that it would be invisible without scrolling to the right. This extra code installs the actual malware, which is obfuscated even further to hide its true purpose. The malware also survives reboots.
[5]
The next step was to replace instances of the genuine PyPI domain with the doppelganger URL on GitHub. Pip, the package manager for Python, allows coders to choose a specific URL for grabbing dependencies, which is what made doing this possible.
[6]Five Eyes tell critical infra orgs: Take these actions now to protect against China's Volt Typhoon
[7]Fujitsu: Miscreants infected our systems with malware, may have stolen customer info
[8]Record breach of French government exposes up to 43 million people's data
[9]Microsoft confirms Russian spies stole source code, accessed internal systems
Of course, not just anyone can make a commit to a big GitHub project like Top.gg, which is why the attacker broke into multiple GitHub accounts, such as editor-syntax, one of Top.gg's maintainers. It's unclear how editor-syntax's account was compromised, but it could have been through stolen cookies, which would have allowed the attacker to gain access without needing the password.
Via their GitHub account, the attacker made a commit to Top.gg that ostensibly changed one thing, but also inserted the fake Colorama package in between several real URLs, making it stand out less. In repos maintained by other compromised accounts, the attacker made commits where several packages hosted on the real website were added along with the fake Colorama package. This also helped to conceal the existence of the doppelganger URL because it's easy to overlook a single domain name change among several lines of altered code.
On March 3, Top.gg users realized that the GitHub repo was compromised and informed editor-syntax that he had made the commit that added the doppelganger URL. He first said "I haven't even contributed to that repository" but once a user showed him he his account definitely did it, he replied "bro what."
It's impossible to know how many users exactly may have been affected, but the fact that the malware made its way into the GitHub repository of a 170,000-strong Discord server suggests it could have been at least thousands or even tens of thousands.
[10]
[11]Developers have been making efforts for years to ensure the integrity of open source package managers like PyPI, but it's certainly difficult to defend against attacks that utilize as many vectors as this one. ®
Get our [12]Tech Resources
[1] https://checkmarx.com/blog/over-170k-users-affected-by-attack-using-fake-python-infrastructure/?
[2] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/cybercrime&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2ZgICB5yLxse7bUXo0PYU1wAAAJQ&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0
[3] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/cybercrime&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZgICB5yLxse7bUXo0PYU1wAAAJQ&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0
[4] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/cybercrime&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZgICB5yLxse7bUXo0PYU1wAAAJQ&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0
[5] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/cybercrime&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZgICB5yLxse7bUXo0PYU1wAAAJQ&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0
[6] https://www.theregister.com/2024/03/20/five_eyes_volt_typhoon/
[7] https://www.theregister.com/2024/03/18/fujitsu_malware_data_breach/
[8] https://www.theregister.com/2024/03/14/mega_data_breach_at_french/
[9] https://www.theregister.com/2024/03/08/microsoft_confirms_russian_spies_stole/
[10] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/cybercrime&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZgICB5yLxse7bUXo0PYU1wAAAJQ&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0
[11] https://www.theregister.com/2023/01/09/pypi_aws_malware_key/
[12] https://whitepapers.theregister.com/
Re: Stolen Cookies
Because if you're using a website from a phone while on a train, your IP address will be changing constantly.
Re: Stolen Cookies
Will it? I thought most train networks were behind NAT? As are most mobile networks?
I realise NAT is not an ideal solution to anything by any means.. There was once a thing called Mobile IP that would let you keep the same address on the move..
But if someone jumps in with an IP address from a completely different provider/continent with your cookies, it should be suspicious enough to require re-authentication, no?
Cookies? Wouldn't it require SSH/GPG keys?
Even if the hacker hijacked cookies of the Github account page, they shouldn't be able to make a push without the private SSH/GPG keys, or add keys without logging in again with a password.
Obviously, if the hacker was inside editor-syntax's computer with a keystroke collector, they could anything - but that's more than cookies.
I thought github enforced 2fa, so stuff like this couldnt happen.
Stolen Cookies
Why are cookies trusted across IP address changes..?
All the better to track you with, little red riding hood..