Researchers have discovered 11 new malicious open-source packages using various advanced techniques to avoid detection on the popular PyPl repository.
Python’s official third-party software repository is home to over half a million developers, who typically use pre-built open-source packages to accelerate time-to-market.
However, threat actors are increasingly infiltrating these upstream sources for their own ends.
The JFrog Security research team yesterday revealed it had discovered 11 new malware packages with over 40,000 downloads from PyPl. Their authors used a range of techniques to stay hidden and therefore infect as many users as possible.
These included using the Fastly CDN to disguise traffic sent to their command and control (C2) server as a legitimate communication with pypi.org.
Another technique was to use the TrevorC2 framework to make client-server communications look similar to regular website browsing. According to JFrog, the client sends requests at random intervals and hides the malicious payload into normal-looking HTTP GET requests.
They were also observed using DNS tunneling, a popular technique that uses DNS requests – not normally inspected by security tools – as a communication channel between the victim machine and the C2 server.
In some cases, the malicious packages were split into two – a malicious element designed to steal Discord authentication tokens and a ‘legitimate’ package that doesn’t contain harmful functionality. The latter can be installed through typosquatting or “dependency confusion,” according to the report.
The discovery comes months after the same research team found eight malicious packages that had already been downloaded 30,000 times.
“While this set of malicious packages may not have the same ‘teeth’ as our previous discoveries, what’s notable is the increasing level of sophistication with which they are executed,” they said of the latest find.
“It’s not reaching for your wallet in broad daylight – but there is a lot more subterfuge going on with these packages, and some of them may even be setting up for a follow-up attack after the initial reconnaissance, instead of running a highly-compromising payload to start.”
According to a September Sonatype report, attacks on the upstream software supply chain surged 650% year-on-year.
The PyPl maintainers have now removed the offending packages, according to JFrog.
Phil Muncaster UK / EMEA News Reporter, Infosecurity Magazine