RubyGems.org gem replacement security vulnerability and mitigation
RubyGems.org had a bug that allowed an unauthorised user to replace existing .gem files for certain gem versions by exploiting the gem and version name combination. An attacker could force the replacement of a .gem file in the S3 bucket, though the replaced file would not be installable via the standard gem install command.
blog.rubygems.org
Published on blog.rubygems.org
RubyGems.org contained a bug that could allow an attacker to replace some .gem files on our servers with a different file that they supplied. We deployed a partial fix on April 2nd and a complete fix on April 4th, 2016.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
Gems with a dash in the name pushed between June 11th, 2014 and April 2nd, 2016 were vulnerable, but gems pushed after Feb 8th, 2015 were verified as unchanged, and the replaced file would not be installable via the standard gem install command.
What the attacker needed
Gem name contains a dash; gem version pushed before Apr 2, 2016
The fix
The vulnerability was fixed by deploying a partial fix on April 2nd and a complete fix on April 4th, 2016.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
RubyGems.org is a service that hosts Ruby libraries (called gems) for people to download and install. A bug let someone overwrite an existing gem file with their own file, but only for gems with a dash in the name and only under certain conditions. The replaced file could not be installed normally, so the practical risk was limited.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.