Vulnerabilities in pkg:maven/org.elasticsearch.client/elasticsearch-rest-client
PACKAGECVE-2021-22145 is a MODERATE (CVSS 6.5) generation of error message containing vulnerability (CWE-209: Generation of Error Message Containing Sensitive Information) affecting Elasticsearch rest client libraries in the Maven ecosystem. The issue involves generation of error message containing sensitive information in elasticsearch. Remediation is available by upgrading affected packages to version 7.13.4.
pkg:maven/org.elasticsearch.client/elasticsearch-rest-client
Vulnerability advisories affecting package pkg:maven/org.elasticsearch.client/elasticsearch-rest-client. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-q394-h7f5-7f44 | CVE-2021-22145 | MODERATE | Generation of Error Message Containing Sensitive Information in Elasticsearch |
CVE-2021-22145 at a Glance
Security Impact
CVSS: 6.5
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:U/C:H/I:N/A:N).
How to Fix CVE-2021-22145
To remediate this vulnerability, upgrade all affected Elasticsearch rest client 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.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>7.13.4</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.elasticsearch.client
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-22145, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.elasticsearch.client
Analyze the terminal output to locate any version of Elasticsearch rest client in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.13.4), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.elasticsearch.client 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-209: Generation of Error Message Containing Sensitive Information, where the product generates an error message that includes sensitive information about its environment, users, or associated data. In Elasticsearch rest client, 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-22145 Affected Elasticsearch rest client Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.elasticsearch.client:elasticsearch-rest-client
|
Maven |
≥ 7.10.0
< 7.13.4
|
7.13.4
|
References
Frequently Asked Questions
What is CVE-2021-22145?
Which Elasticsearch rest client versions are affected?
What version fixes CVE-2021-22145?
Is elasticsearch-rest-client affected?
What is the CVSS score of CVE-2021-22145?
What CWE is associated with CVE-2021-22145?
How can I check Maven dependencies for CVE-2021-22145?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q394-h7f5-7f44",
"modified" : "2025-07-09T15:02:17Z",
"published" : "2022-05-24T19:08:49Z",
"aliases" : [ "CVE-2021-22145" ],
"summary" : "Generation of Error Message Containing Sensitive Information in Elasticsearch",
"details" : "A memory disclosure vulnerability was identified in Elasticsearch 7.10.0 to 7.13.3 error reporting. A user with the ability to submit arbitrary queries to Elasticsearch could submit a malformed query that would result in an error message returned containing previously used portions of a data buffer. This buffer could contain sensitive information such as Elasticsearch documents or authentication details.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.elasticsearch.client:elasticsearch-rest-client"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.10.0"
}, {
"fixed" : "7.13.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 7.13.3"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-22145"
}, {
"type" : "WEB",
"url" : "https://discuss.elastic.co/t/elasticsearch-7-13-4-security-update/279177"
}, {
"type" : "WEB",
"url" : "https://gist.github.com/lucasdrufva/f9c5d7c9e26ee087b736d727953afd34"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/elastic/elasticsearch"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20210827-0006"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
}, {
"type" : "WEB",
"url" : "http://packetstormsecurity.com/files/163648/ElasticSearch-7.13.3-Memory-Disclosure.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-209" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-22T18:23:29Z",
"nvd_published_at" : "2021-07-21T15:15:00Z"
}
}