# CVE-2021-20230: Auth bypass in stunnel

> Attackers with valid CA-signed certificates can bypass redirect restrictions to access tunneled services, compromising confidentiality.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/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:** 23 Feb 2021
- **Updated:** 3 Aug 2024
- **Also known as:** ALSA-2021:0618, AZL-7375, CLSA-2023-1689701258, DEBIAN-CVE-2021-20230, GHSA-wwrq-59mq-v8w2, MGASA-2021-0284, RHSA-2021:0618, RHSA-2021:0619, RHSA-2021:0620, RLSA-2021:0618, SUSE-SU-2021:0772-1, SUSE-SU-2021:1465-1, UBUNTU-CVE-2021-20230, USN-6901-1, openSUSE-SU-2021:0409-1

## What is CVE-2021-20230?

CVE-2021-20230 is a high-severity authentication bypass vulnerability in stunnel, published on 23 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A flaw was found in stunnel before 5.57, where it improperly validates client certificates when it is configured to use both redirect and verifyChain options. This flaw allows an attacker with a certificate signed by a Certificate Authority, which is not the one accepted by the stunnel server, to access the tunneled service instead of being redirected to the address specified in the redirect option. The highest threat from this vulnerability is to confidentiality.

Weakness: CWE-295 (Improper Certificate Validation)

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

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `stunnel` | AlmaLinux:8 | All versions | 5.56-5.el8_3 |
| `stunnel` | Red Hat:enterprise_linux:8::baseos | All versions | 0:5.56-5.el8_3 |
| `stunnel-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:5.56-5.el8_3 |
| `stunnel-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:5.56-5.el8_3 |
| `stunnel` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:5.48-6.el8_1 |
| `stunnel-debuginfo` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:5.48-6.el8_1 |
| `stunnel-debugsource` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:5.48-6.el8_1 |
| `stunnel` | Red Hat:rhel_eus:8.2::baseos | All versions | 0:5.48-6.el8_2 |
| `stunnel-debuginfo` | Red Hat:rhel_eus:8.2::baseos | All versions | 0:5.48-6.el8_2 |
| `stunnel-debugsource` | Red Hat:rhel_eus:8.2::baseos | All versions | 0:5.48-6.el8_2 |
| `stunnel` | Rocky Linux:8 | All versions | 0:5.56-5.el8_3 |
| `stunnel` | SUSE:Enterprise Storage 6 | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise Module for Server Applications 15 SP2 | All versions | 5.57-3.11.1 |
| `stunnel` | SUSE:Linux Enterprise Server 15 SP1-BCL | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise Server 15-LTSS | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise Server for SAP Applications 15 | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Manager Proxy 4.0 | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Manager Retail Branch Server 4.0 | All versions | 5.44-3.8.1 |
| `stunnel` | SUSE:Manager Server 4.0 | All versions | 5.44-3.8.1 |
| `stunnel` | openSUSE:Leap 15.2 | All versions | 5.57-lp152.2.6.1 |

Products: Stunnel Stunnel.

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

Upgrade to a fixed version.

## Is CVE-2021-20230 being exploited?

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

## Other vulnerabilities in stunnel

- [CVE-2001-0060](https://insights.sbomify.com/CVE-2001-0060/): Other in n/a (critical 10.0)
- [CVE-2011-2940](https://insights.sbomify.com/CVE-2011-2940/): Memory corruption in n/a (critical 9.3)
- [CVE-2008-2400](https://insights.sbomify.com/CVE-2008-2400/): Unspecified vulnerability in stunnel before 4.23, when running as a service on Windows, allows local users to gain privileges via unknown attack vectors. (high 7.2)
- [CVE-2008-2420](https://insights.sbomify.com/CVE-2008-2420/): Security feature bypass in n/a (medium 6.8)
- [CVE-2013-1762](https://insights.sbomify.com/CVE-2013-1762/): Integer overflow in n/a (medium 6.6)

## Fix prompt for AI coding agents

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

What it is: CVE-2021-20230 is a high-severity authentication bypass vulnerability in stunnel, published on 23 Feb 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-20230 in the wild and no public exploit code.

Affected product: stunnel. No package-level version data is available, so check the vendor advisory linked from the reference page.

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-20230/ (Markdown: https://insights.sbomify.com/CVE-2021-20230/index.md)
```

## Sources

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

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