The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

rubygems-pwn: A Vulnerability in RubyGems (currently being fixed)

by PeterCooper — 26 August 2011

If you’ve seen people saying to run gem install rubygems-pwn on Twitter (which I don’t advise!), it’s because it’s a proof of concept for a vulnerabilty in RubyGems. The rubygems-pwn project on GitHub has more information about it, but essentially you can push arbitrary Ruby code into gemspec parameters which will then be executed later on. The vulnerability has been discussed in the rubygems repo where a fix has already been made but, hopefully, more general fixes should be made available soon. (If you want to see the direct example of a malicious gemspec, look here.)

Three things that worry me, 1) RubyGems does not seem to have Security Response Guidelines in place for responding to vulnerabilities, 2) this was a trivial mistake that none of the RubyGems maintainers caught 3) this vulnerability has existed since the first release of RubyGems, we have all been vulnerable this entire time.

Also the rubygems-pwn PoC is harmless (just calls puts and the say command). Although, I wouldn’t install it on a production server. ;)

Now, let’s get everyone upgraded!

postmodern — 27 August 2011

The problem there is a lot of people deliberately use old versions of RubyGems due to the… “changes” since around 1.7 onwards. I wonder if backported releases or patches will be made available.

PeterCooper — 27 August 2011

@peterc Has the Ruby Security team sent an Advisory out yet? I can’t find anything on ruby-lang.org or on Google.

postmodern — 29 August 2011

SlimGems will be releasing a backport fix for this issue in the 1.3.x line, so if you use RubyGems pre 1.7, SlimGems is still an actively maintained branch.

Loren Segal — 7 September 2011

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will bedirected via GitHub to signup or sign in