Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 466872 (CVE-2013-3221) - dev-ruby/activerecord: Data-type injection attacks due absent database column data type (input vs stored value) check (CVE-2013-3221)
Summary: dev-ruby/activerecord: Data-type injection attacks due absent database column...
Status: RESOLVED WONTFIX
Alias: CVE-2013-3221
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
URL: https://bugzilla.redhat.com/show_bug....
Whiteboard: B4 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-23 09:00 UTC by Agostino Sarubbo
Modified: 2015-06-13 07:47 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2013-04-23 09:00:33 UTC
From ${URL} :

Common Vulnerabilities and Exposures assigned an identifier CVE-2013-3221 to the following 
vulnerability:

The Active Record component in Ruby on Rails 2.3.x, 3.0.x, 3.1.x, and 3.2.x does not ensure that 
the declared data type of a database column is used during comparisons of input values to stored 
values in that column, which makes it easier for remote attackers to conduct data-type injection 
attacks against Ruby on Rails applications via a crafted value, as demonstrated by unintended 
interaction between the "typed XML" feature and a MySQL database.

References:
[1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-3221
[2] http://openwall.com/lists/oss-security/2013/02/06/7
[3] 
https://groups.google.com/group/rubyonrails-security/msg/1f3bc0b88a60c1ce?dmode=source&output=gplain
[4] http://pl.reddit.com/r/netsec/comments/17yajp/mysql_madness_and_rails/
[5] http://www.phenoelit.org/blog/archives/2013/02/index.html


@maintainer(s): after the bump, please say explicitly if the package is ready for the stabilization or not
Comment 1 GLSAMaker/CVETool Bot gentoo-dev 2013-05-09 12:16:41 UTC
CVE-2013-3221 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2013-3221):
  The Active Record component in Ruby on Rails 2.3.x, 3.0.x, 3.1.x, and 3.2.x
  does not ensure that the declared data type of a database column is used
  during comparisons of input values to stored values in that column, which
  makes it easier for remote attackers to conduct data-type injection attacks
  against Ruby on Rails applications via a crafted value, as demonstrated by
  unintended interaction between the "typed XML" feature and a MySQL database.
Comment 2 Manuel Rüger (RETIRED) gentoo-dev 2015-06-09 14:29:17 UTC
See: https://bugzilla.redhat.com/show_bug.cgi?id=954365#c6

Statement CVE-2013-3221:

Not a security issue.  This issue is due to the handling of data types when passing data between rubygem-activerecord and MySQL.  Applications that use rubygem-activerecord and MySQL may be affected if written in a way that exposes the issue, however any flaw would be specific to that application. For further information, please refer to https://bugzilla.redhat.com/show_bug.cgi?id=954365#c5
Comment 3 Yury German Gentoo Infrastructure gentoo-dev 2015-06-13 07:47:46 UTC
Information on how to avoid the problem.

As per comment 4, this issue cannot be directly addressed in rubygem-activerecord or MySQL as the issue is in the intersection of these two applications due to type handling. Without a major restructuring of how data is handled within rubygem-activerecord or MySQL it is up to developers to write applications safely:

As mentioned in the original advisory (http://openwall.com/lists/oss-security/2013/02/06/7):

There are two options to avoid these problems.  The first is to
disable JSON and XML parameter parsing.  Depending on the version of
rails you use you will have to place one of the following snippets in
an application initializer

Rails 3.2, 3.1 and 3.0:
  ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
  ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::JSON)

Rails 2.3:
  ActionController::Base.param_parsers.delete(Mime::XML)
  ActionController::Base.param_parsers.delete(Mime::JSON)

If your application relies on accepting these formats you will have to
take care to explicitly convert parameters to their intended types.
For example:

  User.where(:login_token=>params[:token].to_s)