CVE-2013-3221: Activerecord Active Record Component Vulnerability
CRITICALCVE-2013-3221 is a CRITICAL active record component vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Activerecord libraries in the RubyGems ecosystem. The issue involves active record component in ruby on rails has a data-type injection vulnerability. Remediation is available by upgrading affected packages to version 4.2.0.
CVE-2013-3221 at a Glance
How to Fix CVE-2013-3221
To remediate this vulnerability, upgrade all affected Activerecord dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade activerecord to 4.2.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for activerecord
How to Check if You Are Affected
To determine whether your application is affected by CVE-2013-3221, inspect your project dependencies for Activerecord:
inspect dependencies for activerecord
Analyze the terminal output to locate any version of Activerecord in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Activerecord, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2013-3221 Affected Activerecord Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
activerecord
|
RubyGems |
< 4.2.0
|
4.2.0
|
References
Frequently Asked Questions
What is CVE-2013-3221?
Which Activerecord versions are affected?
What version fixes CVE-2013-3221?
Is activerecord affected?
What CWE is associated with CVE-2013-3221?
How can I check RubyGems dependencies for CVE-2013-3221?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-f57c-hx33-hvh8",
"modified" : "2026-02-02T20:20:55Z",
"published" : "2022-05-14T00:54:20Z",
"aliases" : [ "CVE-2013-3221" ],
"summary" : "Active Record component in Ruby on Rails has a data-type injection vulnerability",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "activerecord"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2013-3221"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rails/rails"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activerecord/CVE-2013-3221.yml"
}, {
"type" : "WEB",
"url" : "https://groups.google.com/group/rubyonrails-security/msg/1f3bc0b88a60c1ce?dmode=source&output=gplain"
}, {
"type" : "WEB",
"url" : "https://web.archive.org/web/20130825191249/http://www.phenoelit.org/blog/archives/2013/02/index.html"
}, {
"type" : "WEB",
"url" : "http://openwall.com/lists/oss-security/2013/02/06/7"
}, {
"type" : "WEB",
"url" : "http://openwall.com/lists/oss-security/2013/04/24/7"
}, {
"type" : "WEB",
"url" : "http://pl.reddit.com/r/netsec/comments/17yajp/mysql_madness_and_rails"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20", "CWE-89" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2026-02-02T20:20:55Z",
"nvd_published_at" : "2013-04-22T03:27:00Z"
}
}