# CVE-2021-22138: Security feature bypass in Elasticsearch

> Attackers can intercept Logstash monitoring data via man-in-the-middle attacks due to improper TLS certificate validation when a trusted CA is specified.

- **Severity:** Low 3.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 May 2021
- **Updated:** 3 Aug 2024
- **Also known as:** BIT-logstash-2021-22138, GHSA-56cm-rmmq-hqpv

## What is CVE-2021-22138?

CVE-2021-22138 is a low-severity vulnerability in Elasticsearch, published on 13 May 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In Logstash versions after 6.4.0 and before 6.8.15 and 7.12.0 a TLS certificate validation flaw was found in the monitoring feature. When specifying a trusted server CA certificate Logstash would not properly verify the certificate returned by the monitoring server. This could result in a man in the middle style attack against the Logstash monitoring data.

Weakness: CWE-295 (Improper Certificate Validation)

## Which versions are affected by CVE-2021-22138?

1 open source package ship an affected version, including logstash. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `logstash` | Bitnami | From 6.4.0 | 6.8.15, 7.12.0 |

Products: Elastic Logstash.

## How do I fix CVE-2021-22138?

Upgrade logstash to a fixed version for your release line: 6.8.15 or 7.12.0.

## Is CVE-2021-22138 being exploited?

There is no known exploitation of CVE-2021-22138 in the wild and no public exploit code.

## Other vulnerabilities in Elasticsearch

- [CVE-2019-7612](https://insights.sbomify.com/CVE-2019-7612/): Information disclosure in Logstash (critical 9.8)
- [CVE-2023-46672](https://insights.sbomify.com/CVE-2023-46672/): Logstash Insertion of Sensitive Information into Log File (high 8.4)
- [CVE-2026-33466](https://insights.sbomify.com/CVE-2026-33466/): Improper Limitation of a Pathname to a Restricted Directory in Logstash Leading to Arbitrary File Write (high 8.1)
- [CVE-2019-7620](https://insights.sbomify.com/CVE-2019-7620/): Denial of service in Logstash (high 7.5)
- [CVE-2015-5378](https://insights.sbomify.com/CVE-2015-5378/): Information disclosure in n/a (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-22138 and fix it if it is affected.

What it is: CVE-2021-22138 is a low-severity vulnerability in Elasticsearch, published on 13 May 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-22138 in the wild and no public exploit code.

Affected packages and fixed versions:
- logstash (Bitnami): affected from 6.4.0; fixed in 6.8.15, 7.12.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-22138/ (Markdown: https://insights.sbomify.com/CVE-2021-22138/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-22138
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-22138
- OSV: https://osv.dev/vulnerability/CVE-2021-22138

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-22138/
Summaries are generated and may contain mistakes; the official description above is the record.
