Can anyone with a more intimate knowledge of the inner workings of Ruby on Rails speak to how detrimental this exploit is in practice? I seem to recall a fair number of people feeling the SQL injection exploit from a few days ago was being blown out of proportion and I was wondering how this particular exploit stacks up against it.
I'm not going to say "told you so" because I said nothing and I'm just a layman in this...but when people were pointing out last week that the bug was "overblown" I had wondered if they were underestimating the tendency for such vulnerable patterns to propagate. The mechanisms that let even an edge case in are not always isolated.
Multiple vulnerabilities in parameter parsing in Action Pack
261–270 of 294 posts
Re: Multiple vulnerabilities in parameter parsing in Action Pack
#262Earlier quoted context omitted.
I'm not going to say "told you so" because I said nothing and I'm just a layman in this...but when people were pointing out last week that the bug was "overblown" I had wondered if they were underestimating the tendency for such vulnerable patterns to propagate. The mechanisms that let even an edge case in are not always isolated.
Oh I'm saying "told you so". Since years and years. The real problem is the very mentality of the people who downplay security issues, always saying "this is not a serious issue" (or, worse, saying "but language xxx / framework yyy" suffers from issues too, it's how the world works). That mentality is the reason why such exploits do exist in the first place. Security is nearly always an afterthought. The most brainde…
Also, the message was not "overblown". It was "don't panic, but still upgrade ASAP".
Re: Multiple vulnerabilities in parameter parsing in Action Pack
#263Earlier quoted context omitted.
Hmm, looking around I am thinking that if you don't want random object instantiation, this monkey-patch: module YAML; @@tagged_classes.delete('tag:ruby.yaml.org,2002:object'); end makes user-supplied YAML a lot less dangerous. I am going to poke this into a production application and see if anything breaks - it really really shouldn't
It breaks YAML deserialization in other places. You could enable and disable it on demand in the XML parser, but a more sensible solution is just to get YAML the hell out of the XML processor. Trying to make YAML safer is probably not the right approach.
But by taking out Object, YAML is only left with a whitelist of types that are safe, anything else will get turned into a YAML::DomainType.
Re: Multiple vulnerabilities in parameter parsing in Action Pack
#264Earlier quoted context omitted.
Hmm, looking around I am thinking that if you don't want random object instantiation, this monkey-patch: module YAML; @@tagged_classes.delete('tag:ruby.yaml.org,2002:object'); end makes user-supplied YAML a lot less dangerous. I am going to poke this into a production application and see if anything breaks - it really really shouldn't
This doesn't stop instantiating with !ruby/object
irb(main):001:0> YAML::parse("!ruby/object:File 123").transform
=> #
irb(main):002:0> module YAML; @@tagged_classes.delete('tag:ruby.yaml.org,2002:object'); end
=> Object
irb(main):003:0> YAML::parse("!ruby/object:File 123").transform
=> #
That's neutered what it'll do without causing the parser to blow up.Re: Multiple vulnerabilities in parameter parsing in Action Pack
#265Earlier quoted context omitted.
I specifically asked them to elaborate on what could be made better.
There are specific things that could be said about the bug in question, like not being secure by default, but this doesn't fix the underlying problem. The development team should recognize that security is an important part of the project and act accordingly.
Re: Multiple vulnerabilities in parameter parsing in Action Pack
#266Earlier quoted context omitted.
Aaron is the only person on core who is paid to work on Rails. (Among other things.) I am a committer, and part of my job is to work on open source. Ish. Other than that, it's everyone else's spare time, IIRC.
Wow, that actually gives me more confidence because we have people doing it because they feel passionate about it. Thanks for your hard work.... I've been busy with some other small OS projects (and stuff that pays the bills) but personally feel like I need to try to carve out some time this year to do something to contribute back to Rails.....
Re: Multiple vulnerabilities in parameter parsing in Action Pack
#267Earlier quoted context omitted.
Less magic. The more magic, unexpected behavior you have when parsing untrusted input, the more likely you are to have security holes. Instead of building up some complex object based on untrusted input, the author of the application should specify the values and types expected, and the parser should parse those and nothing more. This would lead to much simpler code paths, as the user never has an object that has une…
This sounds a lot like strong_parameters, which (I believe) will be the default in Rails 4, and is only a gem install away from Rails 3.2 apps. https://github.com/rails/strong_parameters
Re: Multiple vulnerabilities in parameter parsing in Action Pack
#268Re: Multiple vulnerabilities in parameter parsing in Action Pack
#269Earlier quoted context omitted.
Who'd have thought it? Hugely dynamic language turns out to be difficult to audit or analyse for security issues. It was never about Java(C, C++) vs. Ruby despite what fanboys on either side made out. It was about conservative vs. devil-may-care. All that "convenience" and "it's so clean" came at the price of a whole load of code executed behind the scenes. You didn't write it, and the Gods of TDD preached that you d…
Wait, which one of us are you?
You've escaped anyway.
Re: Multiple vulnerabilities in parameter parsing in Action Pack
#270Earlier quoted context omitted.
I don't speak Ruby. Can you or someone else be more precise about where that introduces the vulnerability? (Surely it isn't that YAML::load(content) can run arbitrary shell code?)
Calling YAML::load on attacker-controlled content in a Ruby app of any complexity is very bad news. As Ben and 'judofyr said: this is remote code execution.