# CVE-2021-23840: Integer overflow in CipherUpdate

> An integer overflow in OpenSSL's cipher update functions can cause applications to crash or behave incorrectly when processing large inputs.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 16 Feb 2021
- **Updated:** 16 Apr 2026
- **Also known as:** ALPINE-CVE-2021-23840, AZL-41976, BIT-node-2021-23840, BIT-node-min-2021-23840, CLEANSTART-2026-AD83127, CLSA-2021-1632261785, CLSA-2021-1634922862, DEBIAN-CVE-2021-23840, GHSA-qgm6-9472-pwq7, JLSEC-2026-221, RUSTSEC-2021-0057, UBUNTU-CVE-2021-23840

## What is CVE-2021-23840?

CVE-2021-23840 is a high-severity vulnerability in Debian Debian Linux, published on 16 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Calls to EVP_CipherUpdate, EVP_EncryptUpdate and EVP_DecryptUpdate may overflow the output length argument in some cases where the input length is close to the maximum permissable length for an integer on the platform. In such cases the return value from the function call will be 1 (indicating success), but the output length value will be negative. This could cause applications to behave incorrectly or crash. OpenSSL versions 1.1.1i and below are affected by this issue. Users of these versions should upgrade to OpenSSL 1.1.1j. OpenSSL versions 1.0.2x and below are affected by this issue. However OpenSSL 1.0.2 is out of support and no longer receiving public updates. Premium support customers of OpenSSL 1.0.2 should upgrade to 1.0.2y. Other users should upgrade to 1.1.1j. Fixed in OpenSSL 1.1.1j (Affected 1.1.1-1.1.1i). Fixed in OpenSSL 1.0.2y (Affected 1.0.2-1.0.2x).

Weakness: CWE-190 (Integer Overflow or Wraparound)

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

5 open source packages ship an affected version, including openssl-src, node and node-min. It affects 21 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `openssl-src` | crates.io | All versions | 111.14.0 |
| `openssl-src` | crates.io | All versions | 111.14.0 |
| `openssl-src` | crates.io | From 0.0.0-0 | 111.14.0 |
| `node` | Bitnami | From 10.0.0 | 10.12.1, 10.24.0, 12.12.1, 12.21.0, 14.14.1, 14.15.1, 15.10.0 |
| `node-min` | Bitnami | From 10.0.0 | 10.12.1, 10.24.0, 12.12.1, 12.21.0, 14.14.1, 14.15.1, 15.10.0 |

Products: Debian Debian Linux, Fujitsu M10-1 Firmware, Fujitsu M10-4 Firmware, Fujitsu M10-4s Firmware, Fujitsu M12-1 Firmware, Fujitsu M12-2 Firmware, Fujitsu M12-2s Firmware, Mcafee Epolicy Orchestrator, Nodejs Node.js, Openssl Openssl, Oracle Business Intelligence, Oracle Communications Cloud Native Core Policy, Oracle Enterprise Manager for Storage Management, Oracle Enterprise Manager Ops Center, Oracle Graalvm, Oracle Jd Edwards Enterpriseone Tools, Oracle Jd Edwards World Security, Oracle Mysql Server, Oracle Nosql Database, Tenable Log Correlation Engine and 1 more.

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

Upgrade openssl-src to 111.14.0 or later.

## Is CVE-2021-23840 being exploited?

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

Public exploit code:

- https://github.com/Trinadh465/openssl-1.1.1g_CVE-2021-23840 (github_poc): https://github.com/Trinadh465/openssl-1.1.1g_CVE-2021-23840

## Other vulnerabilities in Debian Debian Linux

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

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

What it is: CVE-2021-23840 is a high-severity vulnerability in Debian Debian Linux, published on 16 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-23840 in the wild and no public exploit code.

Affected packages and fixed versions:
- openssl-src (crates.io): affected all versions; fixed in 111.14.0
- openssl-src (crates.io): affected all versions; fixed in 111.14.0
- openssl-src (crates.io): affected from 0.0.0-0; fixed in 111.14.0
- node (Bitnami): affected from 10.0.0; fixed in 10.12.1, 10.24.0, 12.12.1, 12.21.0, 14.14.1, 14.15.1, 15.10.0
- node-min (Bitnami): affected from 10.0.0; fixed in 10.12.1, 10.24.0, 12.12.1, 12.21.0, 14.14.1, 14.15.1, 15.10.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-23840/ (Markdown: https://insights.sbomify.com/CVE-2021-23840/index.md)
```

## Sources

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

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