Security researchers from ReversingLabs say they’ve discovered 725 Ruby libraries uploaded on the official RubyGems repository that contained malware meant to hijack users’ clipboards.
The malicious packages were uploaded on RubyGems between February 16 and 25 by two accounts — Jim Carrey and Peter Gibbons.
What ruby libraries are affected?
The 725 libraries, which are listed here in full, have been removed two days later, on February 27, after the ReversingLabs team notified the RubyGems security team.
All the Ruby libraries were copies of legitimate libraries, used lookalike names, worked as intended, but also contained additional malicious files.
The extra file inserted into each package was named aaa.png. However, ReversingLabs say this file wasn’t a PNG image, but instead was a Windows PE executable.
Installing each of the malicious libraries triggered an infection chain that looked like this:
- The PE file dropped a Ruby script called aaa.rb containing the Ruby interpreter and all the required dependencies to run.
- The Ruby script then dropped a Visual Basic script called oh.vbs
- This script then set up an autorun registry key
- The autorun key then executed a second Visual Basic script every time a computer ran/rebooted
- This second script would capture data sent to the clipboard, look for text patterns that looked like cryptocurrency addresses, and then replace the text with the attacker’s address.
Researchers say they believe that this attack was carried out by the same person/group who uploaded malware-laced libraries on the RubyGems package repository before, in 2018 and 2019 — both incidents using similar techniques and also aimed at stealing money from cryptocurrency users.
This also marks the second time that ReversingLabs has found malicious libraries uploaded to a package repository. In July 2019, the company also found three malicious Python libraries uploaded on the PyPI portal.