CVE-2012-2694: Medium severity rubyonrails Rails vulnerability
actionpack/lib/actiondispatch/http/request.rb in Ruby on Rails before 3.0.14, 3.1.x before 3.1.6, and 3.2.x before 3.2.6 does not properly consider differences in parameter handling between the Active Record component and the Rack interface, which allows remote attackers to bypass intended database-query restrictions and perform NULL checks via a crafted request, as demonstrated by certain ['xyz', nil] values, a related issue to CVE-2012-2660.
Other sources
actionpack/lib/actiondispatch/http/request.rb in Ruby on Rails before 3.0.14, 3.1.x before 3.1.6, and 3.2.x before 3.2.6 does not properly consider differences in parameter handling between the Active Record component and the Rack interface, which allows remote attackers to bypass intended database-query restrictions and perform NULL checks via a crafted request, as demonstrated by certain "['xyz', nil]" values, a related issue to CVE-2012-2660.
Originally the CVE identifier of CVE-2012-2660 has been assigned to the following issue:
A security flaw was found in the way rubygem-actionpack, the web-flow and rendering framework putting the VC in MVC, performed SQL query generation based on the content of params hash. If a Ruby on Rails application used Rack to parse query parameters, those parameters were not sanitized for the presence of the 'nil' value and that application relied, when performing user authentication, certain params value not to be 'nil', a remote attacker could use this flaw to bypass the authentication, leading to information disclosure and / or unauthorized access to the service. (bug 827353)
Recently (2012-06-12) it has been reported: [1] https://groups.google.com/group/rubyonrails-security/browsethread/thread/8c82d9df8b401c5e
that there still exists a variant of this attack, which is possible to exploit even the upstream patch for the original CVE-2012-2660 issue has been applied. More from [1]:
--
Due to the way Active Record interprets parameters in combination with the way that Rack parses query parameters, it is possible for an attacker to issue unexpected database queries with "IS NULL" where clauses. This issue does not let an attacker insert arbitrary values into an SQL query, however they can cause the query to check for NULL where most users wouldn't expect it.
For example, a system has password reset with token functionality:
unless params[:token].nil? user = User.findbytoken(params[:token]) user.resetpassword! end
An attacker can craft a request such that params[:token] will return ['xyz', nil]. The ['xyz', nil] value will bypass the test for nil, but will still add an "IN ('xyz', NULL)" clause to the SQL query.
All users running an affected release should either upgrade or use one of the work arounds immediately. All users running an affected release should upgrade immediately. Please note, this vulnerability is a variant of CVE-2012-2660, even if you upgraded to address that issue, you must take action again.
--
Upstream patches: [2] https://groups.google.com/group/rubyonrails-security/attach/e2d3a87f2c211def/3-0-nullarrayparam.patch?part=3 (against v3.0 branch) [3] https://groups.google.com/group/rubyonrails-security/attach/e2d3a87f2c211def/3-1-nullarrayparam.patch?part=4 (against v3.1 branch) [4] https://groups.google.com/group/rubyonrails-security/attach/e2d3a87f2c211def/3-2-nullarrayparam.patch?part=5 (against v3.2 branch)
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2012-2694?
CVE-2012-2694 has a CVSS score indicating a medium severity vulnerability that could allow remote attackers to bypass intended database access controls.
How do I fix CVE-2012-2694?
To mitigate CVE-2012-2694, upgrade Ruby on Rails to versions 3.2.6, 3.1.6, or 3.0.14 and later.
Which versions of Ruby on Rails are affected by CVE-2012-2694?
CVE-2012-2694 affects Ruby on Rails versions before 3.0.14, 3.1.x before 3.1.6, and 3.2.x before 3.2.6.
What type of attacks can exploit CVE-2012-2694?
CVE-2012-2694 allows remote attackers to bypass database access controls by exploiting weaknesses in parameter handling.
Is CVE-2012-2694 relevant for my application?
If your application uses Ruby on Rails version prior to the secure releases mentioned, it is vulnerable to CVE-2012-2694.