Bug 831581 (CVE-2012-2694)

Summary: CVE-2012-2694 rubygem-actionpack: Unsafe query generation (a different flaw than CVE-2012-2660)
Product: [Other] Security Response Reporter: Jan Lieskovsky <jlieskov>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: bkabrda, ccoleman, hbrock, jeckersb, jrusnack, mastahnke, mmccune, mmcgrath, mmorsi, morazi, sseago, vanmeeuwen+fedora, vondruch
Target Milestone: ---Keywords: Reopened, Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-actionpack 3.2.6, rubygem-actionpack 3.1.6, rubygem-actionpack 3.0.14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-19 05:07:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 831586, 831729, 831801, 846728, 903993    
Bug Blocks: 767033, 836071    

Description Jan Lieskovsky 2012-06-13 11:17:11 UTC
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/browse_thread/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.find_by_token(params[:token])
      user.reset_password!
    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-null_array_param.patch?part=3
    (against v3.0 branch)
[3] https://groups.google.com/group/rubyonrails-security/attach/e2d3a87f2c211def/3-1-null_array_param.patch?part=4
    (against v3.1 branch)
[4] https://groups.google.com/group/rubyonrails-security/attach/e2d3a87f2c211def/3-2-null_array_param.patch?part=5
    (against v3.2 branch)

Comment 1 Jan Lieskovsky 2012-06-13 11:20:40 UTC
This issue affects the versions of the rubygem-actionpack package, as shipped with Fedora release of 15, 16, and 17. Please schedule an update.

--

This issue did NOT affect the version of the rubygem-actionpack package, as shipped with Fedora EPEL 5 (the relevant functionality is not present in that version yet).

Comment 3 Jan Lieskovsky 2012-06-13 11:25:40 UTC
Created rubygem-actionpack tracking bugs for this issue

Affects: fedora-all [bug 831586]

Comment 7 Fedora Update System 2012-06-30 08:25:45 UTC
rubygem-actionpack-3.0.11-5.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2012-06-30 08:26:13 UTC
rubygem-actionpack-3.0.10-7.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 errata-xmlrpc 2012-12-04 19:31:30 UTC
This issue has been addressed in following products:

  CloudForms for RHEL 6

Via RHSA-2012:1542 https://rhn.redhat.com/errata/RHSA-2012-1542.html

Comment 10 errata-xmlrpc 2013-01-10 20:42:18 UTC
This issue has been addressed in following products:

  Red Hat Subscription Asset Manager 1.1

Via RHSA-2013:0154 https://rhn.redhat.com/errata/RHSA-2013-0154.html

Comment 12 errata-xmlrpc 2013-02-28 19:07:48 UTC
This issue has been addressed in following products:

  RHEL 6 Version of OpenShift Enterprise

Via RHSA-2013:0582 https://rhn.redhat.com/errata/RHSA-2013-0582.html