CVE-2016-6317 ActiveRecord in Ruby on Rails allows database-query bypass

High 7.5 Published Updated

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.

Weakness: CWE-476, CWE-284

Which versions are affected by CVE-2016-6317?

2 open source packages ship an affected version, including activerecord. It affects 1 product.

PackageAffectedFixed in
activerecord RubyGemsFrom 4.2.04.2.7.1
activerecord RubyGemsFrom 4.2.04.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.

All Rubyonrails Rails vulnerabilities

Sources

Also known as DEBIAN-CVE-2016-6317, GHSA-pr3r-4wrp-r2pv.

Is CVE-2016-6317 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free