CVE-2021-30181: Dubbo Code Injection Vulnerability
CRITICALCVE-2021-30181 is a CRITICAL (CVSS 9.8) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Dubbo libraries in the Maven ecosystem. The issue involves code injection in apache dubbo. Remediation is available by upgrading affected packages to version 2.6.9, 2.7.10.
CVE-2021-30181 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-30181
To remediate this vulnerability, upgrade all affected Dubbo 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>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.9</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>2.7.10</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=com.alibaba
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-30181, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=com.alibaba
Analyze the terminal output to locate any version of Dubbo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.9), your application is affected.
Note: The mvn dependency:tree -Dincludes=com.alibaba 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Dubbo, 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-30181 Affected Dubbo Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
com.alibaba:dubbo
|
Maven |
≥ 2.5.0
< 2.6.9
|
2.6.9
|
|
org.apache.dubbo:dubbo
|
Maven |
≥ 2.5.0
< 2.7.10
|
2.7.10
|
References
Frequently Asked Questions
What is CVE-2021-30181?
Which Dubbo versions are affected?
What version fixes CVE-2021-30181?
Is dubbo affected?
What is the CVSS score of CVE-2021-30181?
What CWE is associated with CVE-2021-30181?
How can I check Maven dependencies for CVE-2021-30181?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qmfc-6www-fjqw",
"modified" : "2022-03-18T17:57:04Z",
"published" : "2022-03-18T17:57:04Z",
"aliases" : [ "CVE-2021-30181" ],
"summary" : "Code injection in Apache Dubbo",
"details" : "Apache Dubbo prior to 2.6.9 and 2.7.10 supports Script routing which will enable a customer to route the request to the right server. These rules are used by the customers when making a request in order to find the right endpoint. When parsing these rules, Dubbo customers use ScriptEngine and run the rule provided by the script which by default may enable executing arbitrary code.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "com.alibaba:dubbo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.5.0"
}, {
"fixed" : "2.6.9"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.dubbo:dubbo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.5.0"
}, {
"fixed" : "2.7.10"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-30181"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/re22410dc704a09bc7032ddf15140cf5e7df3e8ece390fc9032ff5587%40%3Cdev.dubbo.apache.org%3E"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-06-02T20:15:20Z",
"nvd_published_at" : "2021-06-01T14:15:00Z"
}
}