Bug 1365017 (CVE-2016-6317)

Summary: CVE-2016-6317 rubygem-activerecord: unsafe query generation in Active Record
Product: [Other] Security Response Reporter: Martin Prpič <mprpic>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: hhorak, jorton, security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-activerecord 4.2.7.1 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the way Active Record handled certain special values in dynamic finders and relations. If a Ruby on Rails application performed JSON parameter parsing, a remote attacker could possibly manipulate search conditions in SQL queries generated by the application.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-13 11:18:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 1366479, 1367060, 1367061    
Bug Blocks: 1365019    
Attachments:
Description Flags
4-2-unsafe-query-generation.patch none

Description Martin Prpič 2016-08-08 11:20:35 UTC
The following flaw was found in Active Record:

Due to the way Active Record interprets parameters in combination with the way that JSON parameters are parsed, it is possible for an attacker to issue unexpected database queries with "IS NULL" or empty 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 or eliminate a WHERE clause when most users wouldn't expect it.

This issue only affects the 4.2.x versions of Active Record.

Comment 1 Martin Prpič 2016-08-08 11:20:43 UTC
Acknowledgments:

Name: the Ruby on Rails project
Upstream: joernchen (Phenoelit)

Comment 3 Martin Prpič 2016-08-08 11:21:35 UTC
Created attachment 1188641 [details]
4-2-unsafe-query-generation.patch

Comment 4 Martin Prpič 2016-08-12 06:00:07 UTC
Created rubygem-activerecord tracking bugs for this issue:

Affects: fedora-all [bug 1366479]

Comment 5 Martin Prpič 2016-08-12 06:00:59 UTC
External References:

https://groups.google.com/forum/#!msg/rubyonrails-security/rgO20zYW33s/gmamLa-wDAAJ

Comment 6 Tomas Hoger 2016-08-12 20:08:04 UTC
Upstream commit:

4.2:
https://github.com/rails/rails/commit/93ab8c2638a5a3aa3e63915a4c646effefbae0ba

Comment 8 errata-xmlrpc 2016-09-13 11:12:27 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.2 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.1 EUS

Via RHSA-2016:1855 https://rhn.redhat.com/errata/RHSA-2016-1855.html