CVE-2020-5257: Administrate SQL Injection Vulnerability
HIGHCVE-2020-5257 is a HIGH (CVSS 7.7) sql injection vulnerability (CWE-943: Improper Neutralization of Special Elements in Data Query Logic) affecting Administrate libraries in the RubyGems ecosystem. The issue involves sort order sql injection in administrate. Remediation is available by upgrading affected packages to version 0.13.0.
CVE-2020-5257 at a Glance
Security Impact
CVSS: 7.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N).
How to Fix CVE-2020-5257
To remediate this vulnerability, upgrade all affected Administrate 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 administrate to 0.13.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for administrate
How to Check if You Are Affected
To determine whether your application is affected by CVE-2020-5257, inspect your project dependencies for Administrate:
inspect dependencies for administrate
Analyze the terminal output to locate any version of Administrate in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.13.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-943: Improper Neutralization of Special Elements in Data Query Logic, where the product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query. In Administrate, 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-2020-5257 Affected Administrate Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
administrate
|
RubyGems |
< 0.13.0
|
0.13.0
|
References
Frequently Asked Questions
What is CVE-2020-5257?
Which Administrate versions are affected?
What version fixes CVE-2020-5257?
Is administrate affected?
What is the CVSS score of CVE-2020-5257?
What CWE is associated with CVE-2020-5257?
How can I check RubyGems dependencies for CVE-2020-5257?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2p5p-m353-833w",
"modified" : "2021-01-08T20:25:54Z",
"published" : "2020-03-13T21:05:44Z",
"aliases" : [ "CVE-2020-5257" ],
"summary" : "Sort order SQL injection in Administrate",
"details" : "In Administrate (rubygem) before version 0.13.0, when sorting by attributes on a dashboard,\nthe direction parameter was not validated before being interpolated into the SQL query.\nThis could present a SQL injection if the attacker were able to modify the `direction` parameter and bypass ActiveRecord SQL protections.\n\nWhilst this does have a high-impact, to exploit this you need access to the Administrate dashboards, which we would expect to be behind authentication.\n\nThis is patched in wersion 0.13.0.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "administrate"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.13.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/thoughtbot/administrate/security/advisories/GHSA-2p5p-m353-833w"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5257"
}, {
"type" : "WEB",
"url" : "https://github.com/thoughtbot/administrate/commit/3ab838b83c5f565fba50e0c6f66fe4517f98eed3"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-2p5p-m353-833w"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/administrate/CVE-2020-5257.yml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-943" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-03-13T21:05:20Z",
"nvd_published_at" : null
}
}