The maintainers of the RubyGems package manager have addressed a critical security flaw that could have been abused to remove gems and replace them with rogue versions under specific circumstances.
“Due to a bug in the yank action, it was possible for any RubyGems.org user to remove and replace certain gems even if that user was not authorized to do so,” RubyGems said in a security advisory published on May 6, 2022.
In a nutshell, the flaw in question, tracked as CVE-2022-29176, enabled anyone to pull certain gems and upload different files with the same name, same version number, and different platforms.
For this to happen, however, a gem needed to have one or more dashes in its name, where the word before the dash was the name of an attacker-controlled gem, and which was created within 30 days or had no updates for over 100 days.
“For example, the gem ‘something-provider’ could have been taken over by the owner of the gem ‘something,'” the project owners explained.
The project maintainers said that there is no evidence that the vulnerability has been exploited in the wild, adding it didn’t receive any support emails from gem owners alerting them to the removal of the libraries without authorization.
“An audit of gem changes for the last 18 months did not find any examples of this vulnerability being used in a malicious way,” the maintainers said. “A deeper audit for any possible use of this exploit is ongoing.”
The disclosure comes as NPM addressed several flaws in its platform that could have been weaponized to facilitate account takeover attacks and publish malicious packages.
Chief among them is a supply chain threat called package planting that could have allowed malicious actors to pass off rogue libraries as legitimate simply by assigning them to trusted, popular maintainers without their knowledge.