Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by jroes on Wednesday January 02, 2013 @05:15PM
(#4999648)
This is how I understand the issue as well. Many people in this thread are commenting about massive dangers, but I don't think anyone has bothered to actually read the references in the CVE.
Also, even open source projects typically ensure or recommend that the secret token be regenerated when using in production environments.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by nbpoole on Wednesday January 02, 2013 @05:24PM
(#4999688)
I think the CVE description is inaccurate in this case. Check out the Rails security email list description, which never mentions sessions.
https://groups.google.com/forum/?fromgroups=#!topic/rubyonra...
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by rst on Wednesday January 02, 2013 @05:17PM
(#4999659)
Different vuln; this one has nothing to do with session cookies.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by jroes on Wednesday January 02, 2013 @05:19PM
(#4999670)
tenderlove mentions it has been assigned CVE-2012-5664. This is that CVE:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-5664
It references two articles that require session secrets.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by tenderlove on Wednesday January 02, 2013 @05:38PM
(#4999767)
Yes, the article does mention session secrets. However, this exploit does not require session secrets. The person who wrote the blog post wrote about essentially two vulnerabilities: session forging and SQL injection.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by Xylakant on Thursday January 03, 2013 @03:08AM
(#5001424)
No, the guy showed a way to to sql injections by using a forged session. The problem is that the sql injection requires a hash with symbols as key and params are stored in HashWithIndifferentAccess which should not symbolize the keys. So to exploit the SQL injection you need a vector that allows you to inject symbolized keys. It might be possible to corrupt the params hash, but I can't think of any at the moment. However, the session can contain any ruby object and thus is a possible vector.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by cheald on Wednesday January 02, 2013 @06:06PM
(#4999907)
I'm pretty sure that the injection only works when you can forge a session because sessions may contain marshalled symbols, and the dynamic finders only accepted symbol option keys as valid. You can't get Rails to construct symbols out of a params hash. Is this a separate vulnerability?
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by tptacek on Wednesday January 02, 2013 @08:09PM
(#5000465)
You can get Rails to construct symbols out of a params hash in some cases.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by cheald on Wednesday January 02, 2013 @09:41PM
(#5000793)
Seconding icambron - how? Because I've been up and down that code and can't see any way to do it. Frankly, I don't think it's possible, because otherwise you would have a trivial DOS vector into any Rails application.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by tptacek on Wednesday January 02, 2013 @10:18PM
(#5000874)
It is possible, but not straightforwardly. There isn't a code path I know of that converts param keys to symbols.
(I wouldn't have said it was possible unless I had a curl line that did it, for what it's worth.)
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by cheald on Wednesday January 02, 2013 @10:21PM
(#5000888)
You're the expert here, but that's really disturbing. Is it fixable?
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by ufo on Wednesday January 02, 2013 @10:13PM
(#5000859)
How is this a DOS vector? Would passing a symbol instead of a string in the parameters cause the app to crash?
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by tptacek on Wednesday January 02, 2013 @10:19PM
(#5000880)
No; the theory behind that attack is, Rails doesn't GC symbols, so you could just repeatedly stuff requests that created new symbols until memory was exhausted. I don't care about that attack (there are others like it), but it's viable.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by cheald on Wednesday January 02, 2013 @10:20PM
(#5000881)
Symbols are interned and never garbage collected, so if you can cause an app to create arbitrary symbols, you can cause it to use up all the RAM on the machine and throw it into swap, effectively killing its ability to respond to requests in any kind of timely fashion.
Re:SQL Injection Vulnerability in Ruby on Rails; affects all...
by icambron on Wednesday January 02, 2013 @08:38PM
(#5000593)
Honest question: how?
It's not just a SQL Injection vulnerability. With that secret token, you can set any session value you like.