Gentoo Logo

Active Record: SQL injection


1.  Gentoo Linux Security Advisory

Version Information

Advisory Reference GLSA 201401-22 / activerecord
Release Date January 21, 2014
Latest Revision January 21, 2014: 1
Impact low
Exploitable remote
Package Vulnerable versions Unaffected versions Architecture(s)
dev-ruby/activerecord < 2.3.14-r1 >= 2.3.14-r1 All supported architectures

Related bugreports: #449826


A vulnerability in Active Record could allow a remote attacker to inject SQL commands.

2.  Impact Information


Active Record is a Ruby gem that allows database entries to be manipulated as objects.


An Active Record method parameter can mistakenly be used as a scope.


A remote attacker could use specially crafted input to execute arbitrary SQL statements.

3.  Resolution Information


The vulnerability may be mitigated by converting the input to an expected value. This is accomplished by changing instances of ‘Post.find_by_id(params[:id])’ in code using Active Record to ‘Post.find_by_id(params[:id].to_s)’


All Active Record users should upgrade to the latest version:

Code Listing 3.1: Resolution

  # emerge --sync
  # emerge --ask --oneshot --verbose ">=dev-ruby/activerecord-2.3.14-r1"

4.  References


Page updated January 21, 2014

Summary: This is a Gentoo Linux Security Advisory

Security Team
Contact Address

Donate to support our development efforts.

Copyright 2001-2014 Gentoo Foundation, Inc. Questions, Comments? Contact us.