Miggo Logo

CVE-2012-2661: Active Record vulnerable to SQL Injection via nested query parameters

N/A

CVSS Score

Basic Information

EPSS Score
0.8472%
Published
10/24/2017
Updated
11/6/2023
KEV Status
No
Technology
TechnologyRuby

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
activerecordrubygems>= 3.0.0, < 3.0.133.0.13
activerecordrubygems>= 3.1.0, < 3.1.53.1.5
activerecordrubygems>= 3.2.0, < 3.2.43.2.4

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from how ActiveRecord's where method handled nested parameters. The security patch modifies ActiveRecord::Relation#where in query_methods.rb to add parameter validation (checking for Hash type) and sanitization using create_binds. This indicates the original implementation lacked proper safeguards for nested query parameters, making it vulnerable to SQL injection through crafted nested hashes. The function appears in stack traces when processing user-supplied parameters for database queries.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

T** **tiv* R**or* *ompon*nt in Ru*y on R*ils *.*.x ***or* *.*.**, *.*.x ***or* *.*.*, *n* *.*.x ***or* *.*.* *o*s not prop*rly impl*m*nt t** p*ssin* o* r*qu*st **t* to * w**r* m*t*o* in *n **tiv*R**or* *l*ss, w*i** *llows r*mot* *tt**k*rs to *on*u*t

Reasoning

T** vuln*r**ility st*ms *rom *ow **tiv*R**or*'s w**r* m*t*o* **n*l** n*st** p*r*m*t*rs. T** s**urity p*t** mo*i*i*s **tiv*R**or*::R*l*tion#w**r* in qu*ry_m*t*o*s.r* to *** p*r*m*t*r v*li**tion (****kin* *or **s* typ*) *n* s*nitiz*tion usin* *r**t*_*i