CVE-2021-23840

7.5 HIGH

📋 TL;DR

This OpenSSL vulnerability involves integer overflow in cryptographic functions (EVP_CipherUpdate, EVP_EncryptUpdate, EVP_DecryptUpdate) when processing input near maximum permissible length. The overflow causes incorrect negative output length values while returning success, potentially leading to application crashes or incorrect behavior. Affected users include those running OpenSSL 1.1.1i and below, or OpenSSL 1.0.2x and below (which is out of public support).

💻 Affected Systems

Products:
  • OpenSSL
Versions: OpenSSL 1.1.1 through 1.1.1i, OpenSSL 1.0.2 through 1.0.2x
Operating Systems: All operating systems using affected OpenSSL versions
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using EVP_CipherUpdate, EVP_EncryptUpdate, or EVP_DecryptUpdate functions with input near maximum length is vulnerable. The vulnerability is in the library itself, not dependent on specific configurations.

📦 What is this software?

Openssl by Openssl

OpenSSL is a robust, commercial-grade toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It provides cryptographic functions and is one of the most widely used libraries for implementing secure communications in applications worldwide.

Learn more about Openssl →

Openssl by Openssl

OpenSSL is a robust, commercial-grade toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It provides cryptographic functions and is one of the most widely used libraries for implementing secure communications in applications worldwide.

Learn more about Openssl →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Application crashes leading to denial of service, potential memory corruption that could enable remote code execution in specific application contexts.

🟠

Likely Case

Application crashes or incorrect cryptographic operations causing service disruption and potential data integrity issues.

🟢

If Mitigated

Minimal impact with proper input validation and length checking in application code, though underlying vulnerability remains.

🌐 Internet-Facing: MEDIUM - Many internet-facing services use OpenSSL, but exploitation requires specific input conditions and may only cause crashes rather than full compromise.
🏢 Internal Only: MEDIUM - Internal applications using affected OpenSSL versions could experience service disruptions or data integrity issues.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting specific input lengths to trigger the integer overflow. While unauthenticated exploitation is possible, the specific conditions needed make widespread weaponization less likely.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: OpenSSL 1.1.1j or OpenSSL 1.0.2y (for premium support customers only)

Vendor Advisory: https://www.openssl.org/news/secadv/20210216.txt

Restart Required: Yes

Instructions:

1. Identify OpenSSL version using 'openssl version'. 2. For OpenSSL 1.1.1i or below: upgrade to 1.1.1j via package manager (apt-get upgrade openssl, yum update openssl, etc.). 3. For OpenSSL 1.0.2x or below: upgrade to 1.1.1j (recommended) or 1.0.2y (premium support only). 4. Restart all services using OpenSSL.

🔧 Temporary Workarounds

Input length validation

all

Implement application-level validation to ensure input lengths to EVP functions stay well below maximum permissible values

Memory limit restrictions

all

Configure memory limits to prevent allocation of buffers near maximum integer size

🧯 If You Can't Patch

  • Implement strict input validation in application code to reject inputs near maximum permissible lengths
  • Deploy network segmentation and monitoring to detect potential exploitation attempts

🔍 How to Verify

Check if Vulnerable:

Run 'openssl version' and check if version is 1.1.1i or below, or 1.0.2x or below

Check Version:

openssl version

Verify Fix Applied:

After patching, run 'openssl version' to confirm version is 1.1.1j or higher (or 1.0.2y for premium support)

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults in OpenSSL cryptographic functions
  • Unexpected negative length values in cryptographic operation logs

Network Indicators:

  • Unusual large input sizes to cryptographic services
  • Service disruption patterns following large data transfers

SIEM Query:

source="*openssl*" AND ("segmentation fault" OR "negative length" OR "EVP_CipherUpdate" OR "EVP_EncryptUpdate" OR "EVP_DecryptUpdate")

🔗 References

📤 Share & Export