CVE-2021-21380: Xwiki platform ratings api SQL Injection Vulnerability
HIGHCVE-2021-21380 is a HIGH (CVSS 7.7) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Xwiki platform ratings api libraries in the Maven ecosystem. The issue involves rating script service expose xwiki to sql injection. Remediation is available by upgrading affected packages to version 12.9.
CVE-2021-21380 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:L/PR:L/UI:N/S:C/C:N/I:H/A:N).
How to Fix CVE-2021-21380
To remediate this vulnerability, upgrade all affected Xwiki platform ratings api dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-ratings-api</artifactId>
<version>12.9</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.xwiki.platform
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-21380, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.xwiki.platform
Analyze the terminal output to locate any version of Xwiki platform ratings api in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 12.9), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.xwiki.platform command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
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 Xwiki platform ratings api, 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-2021-21380 Affected Xwiki platform ratings api Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.xwiki.platform:xwiki-platform-ratings-api
|
Maven |
< 12.9
|
12.9
|
References
Frequently Asked Questions
What is CVE-2021-21380?
Which Xwiki platform ratings api versions are affected?
What version fixes CVE-2021-21380?
Is xwiki-platform-ratings-api affected?
What is the CVSS score of CVE-2021-21380?
What CWE is associated with CVE-2021-21380?
How can I check Maven dependencies for CVE-2021-21380?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-79rg-7mv3-jrr5",
"modified" : "2021-03-23T22:34:44Z",
"published" : "2021-03-23T22:48:01Z",
"aliases" : [ "CVE-2021-21380" ],
"summary" : "Rating Script Service expose XWiki to SQL injection",
"details" : "### Impact\nThis issue impacts only XWiki with the Ratings API installed.\nThe Rating Script Service expose an API to perform SQL requests without escaping the from and where search arguments. \nThis might lead to an SQL script injection quite easily for any user having Script rights on XWiki.\n\n### Patches\nThe problem has been patched in XWiki 12.9RC1.\n\n### Workarounds\nThe only workaround besides upgrading XWiki would be to uninstall the Ratings API in XWiki from the Extension Manager.\n\n### References\nhttps://jira.xwiki.org/browse/XWIKI-17662\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [Jira XWiki](http://jira.xwiki.org)\n* Email us at our [security mailing list](mailto:security@xwiki.org)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.xwiki.platform:xwiki-platform-ratings-api"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "12.9"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/xwiki/xwiki-platform/security/advisories/GHSA-79rg-7mv3-jrr5"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21380"
}, {
"type" : "WEB",
"url" : "https://jira.xwiki.org/browse/XWIKI-17662"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-03-23T22:34:44Z",
"nvd_published_at" : "2021-03-23T23:15:00Z"
}
}