CVE-2021-21380: Xwiki platform ratings api SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-79rg-7mv3-jrr5
CVSS 7.7
CWE-89
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2021-21380
GHSA Identifier GHSA-79rg-7mv3-jrr5
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Xwiki platform ratings api
Package Ecosystem Maven
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (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.

org.xwiki.platform:xwiki-platform-ratings-api fixed: 12.9
<dependency>
    <groupId>org.xwiki.platform</groupId>
    <artifactId>xwiki-platform-ratings-api</artifactId>
    <version>12.9</version>
</dependency>
Verify Direct and Transitive Dependencies

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

### Impact This issue impacts only XWiki with the Ratings API installed. The Rating Script Service expose an API to perform SQL requests without escaping the from and where search arguments. This might lead to an SQL script injection quite easily for any user having Script rights on XWiki. ### Patches The problem has been patched in XWiki 12.9RC1. ### Workarounds The only workaround besides upgrading XWiki would be to uninstall the Ratings API in XWiki from the Extension Manager. ### References https://jira.xwiki.org/browse/XWIKI-17662 ### For more information If you have any questions or comments about this advisory: * Open an issue in [Jira XWiki](http://jira.xwiki.org) * Email us at our [security mailing list](mailto:security@xwiki.org)

CVE-2021-21380 Affected Xwiki platform ratings api Versions

1 component(s)
Fixed Versions:
12.9
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?
CVE-2021-21380 is a security vulnerability in Xwiki platform ratings api involving Rating Script Service expose XWiki to SQL injection under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Xwiki platform ratings api versions are affected?
Affected versions include releases prior to 12.9 across affected packages: org.xwiki.platform:xwiki-platform-ratings-api.
What version fixes CVE-2021-21380?
Upgrading to 12.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is xwiki-platform-ratings-api affected?
Yes, org.xwiki.platform:xwiki-platform-ratings-api is affected in releases prior to 12.9. Upgrade your dependency to 12.9 or later.
What is the CVSS score of CVE-2021-21380?
CVE-2021-21380 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2021-21380?
CVE-2021-21380 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (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.).
How can I check Maven dependencies for CVE-2021-21380?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.xwiki.platform'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}