Attackers Aim at Software Supply Chain with Package Typosquatting
Attackers seed Ruby Gems repository with more than 760 malicious packages using names just a bit different than the standard code libraries.
April 21, 2020
Developers who make a simple typing mistake could find their systems compromised by malware in the latest attack on the software supply chain, say researchers at ReversingLabs, a software analysis platform provider.
The researchers analyzed the package repository for the Ruby language looking for code packages, known as Ruby Gems, submitted to the repository with names similar to existing baseline packages. They found more than 760 malicious Gems with similar names to legitimate packages had polluted the Ruby Gems repository.
The attack is similar to the typosquatting the company found in Python and the Node Package Manager repositories, says Robert Perica, principal engineer and threat analyst at ReversingLabs.
"Like other developers, when a developer mistypes a name and tries to download a package that does not exist, they expect an error that tells them that the package is not available," he says. "But malicious actors are taking advantage of typos and delivering malware instead."
The use of typosquatting to attempt to compromise developers' software and systems is a continuation of attacks on the software supply chain. In the past, developers mainly had to worry about keeping the packages they used up-to-date to close any vulnerabilities in their software.
Over the past few years, however, companies that track open source software packages have noted that attackers have focused on the components that developers often use as the basis for their applications. In 2018, for example, a popular JavaScript package in the Node Package Manager (NPM) repository known as event-stream was compromised with Bitcoin-stealing code and remained undetected for more than two months.
"The presumed attacker ... reportedly offered to help maintain the library," said Danny Grander, co-founder and security lead at software-security firm Snyk, in an analysis of the incident. "Since adding libraries is a common practice, it's easy to see how the new library was not reviewed too carefully. Furthermore, the library appears to have performed the promised functionality."
Compromising an existing open source project is a long con that takes time, however. Typosquatting is much easier and does not require as many resources. The common attack typically focuses on creating file or domain names that are similar to common runtimes or destinations, respectively, in an attempt to catch infrequent typos. The strategy typically pays off when a large volume of requests are involved, making a low percentage mistake still amount to a reasonable number of potential victims.
In the early 2000s, for example, domain registrars began redirecting mistyped domains to their own landing pages — a move to which many privacy advocates, Internet service providers, and browser makers took exception. In 2008, Oliver Friedrichs, then a researcher for Symantec, warned that typosquatting could be used to capture sensitive emails. As an experiment, he registered 124 domains that had close spellings to US presidential candidates and found more than 1,100 connection attempts were sent to the mail handler for those domains.
In the latest case, two developer accounts submitted different misspelled version of RubyGems, such as "atlas-client" instead of the actual "atlas_client," according to ReversingLabs' analysis. The malicious component installed by the fake component infects the developer's system with persistent malware to replace any Bitcoin wallet address on the clipboard with the attacker's wallet address, Perica says.
While most popular more than a decade ago, Ruby continues to be a relevant programming language for back-end Web developers because it powers the Ruby on Rails application framework. The language ranked No. 8 out of all programming languages in May 2016, but it has since fallen to No. 13, according to the ranking maintained by TIOBE, a software quality firm. Developer-knowledge site StackOverflow places the language at No. 12 with about 8% of all developers using Ruby.
The attack against the Ruby Gems repository was fairly simple to spot because the attacker used portable executable files — not typically part of a Ruby Gem — and obvious names, such as "aaaa.png," for the file components. A sneakier attacker could make the malware more difficult to spot, Perica says.
"It all depends on the level of caution that developers have in dealing with the package management frameworks," he says. "We have to practice due diligence as developers and expect mistakes to happen."
Related Content:
A listing of free products and services compiled for Dark Reading by Omdia analysts to help meet the challenges of COVID-19.
Check out The Edge, Dark Reading's new section for features, threat data, and in-depth perspectives. Today's top story: "Cybersecurity Home-School: The Robot Project."
About the Author
You May Also Like
Applying the Principle of Least Privilege to the Cloud
Nov 18, 2024The Right Way to Use Artificial Intelligence and Machine Learning in Incident Response
Nov 20, 2024Safeguarding GitHub Data to Fuel Web Innovation
Nov 21, 2024The Unreasonable Effectiveness of Inside Out Attack Surface Management
Dec 4, 2024