CVE-2016-6317 ActiveRecord in Ruby on Rails allows database-query bypass
Remote attackers can bypass database query restrictions and trigger missing WHERE clauses via crafted requests, potentially exposing or modifying data.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2016-6317?
CVE-2016-6317 is a high-severity SQL injection vulnerability in Rubyonrails Rails, published on 7 Sep 2016. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Action Record in Ruby on Rails 4.2.x before 4.2.7.1 does not properly consider differences in parameter handling between the Active Record component and the JSON implementation, which allows remote attackers to bypass intended database-query restrictions and perform NULL checks or trigger missing WHERE clauses via a crafted request, as demonstrated by certain "[nil]" values, a related issue to CVE-2012-2660, CVE-2012-2694, and CVE-2013-0155.
Which versions are affected by CVE-2016-6317?
2 open source packages ship an affected version, including activerecord. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
activerecord RubyGems | From 4.2.0 | 4.2.7.1 |
activerecord RubyGems | From 4.2.0 | 4.2.7.1 |
Products include Rubyonrails Rails.
How do I fix CVE-2016-6317?
Upgrade activerecord to 4.2.7.1 or later.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2016-6317 being exploited?
There is no known exploitation of CVE-2016-6317 in the wild and no public exploit code.
Public exploit code: 1 proofs of concept on GitHub.
Other vulnerabilities in Rubyonrails Rails
- CVE-2013-0277 Active Record contains deserialization of arbitrary YAML
- CVE-2017-17916 SQL injection in n/a
- CVE-2017-17917 SQL injection in n/a
- CVE-2026-33195 Rails Active Storage has possible Path Traversal in DiskService
- CVE-2024-26142 Rails possible ReDoS vulnerability in Accept header parsing in Action Dispatch
Sources
Also known as DEBIAN-CVE-2016-6317, GHSA-pr3r-4wrp-r2pv.