CVE-2021-3711 SM2 Decryption Buffer Overflow

Critical 9.8 Published Updated

A buffer overflow in OpenSSL's SM2 decryption allows attackers to corrupt memory, potentially causing crashes or executing arbitrary code.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-3711?

CVE-2021-3711 is a critical memory corruption vulnerability in Debian Debian Linux, published on 24 Aug 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

In order to decrypt SM2 encrypted data an application is expected to call the API function EVP_PKEY_decrypt(). Typically an application will call this function twice. The first time, on entry, the "out" parameter can be NULL and, on exit, the "outlen" parameter is populated with the buffer size required to hold the decrypted plaintext. The application can then allocate a sufficiently sized buffer and call EVP_PKEY_decrypt() again, but this time passing a non-NULL value for the "out" parameter. A bug in the implementation of the SM2 decryption code means that the calculation of the buffer size required to hold the plaintext returned by the first call to EVP_PKEY_decrypt() can be smaller than the actual size required by the second call. This can lead to a buffer overflow when EVP_PKEY_decrypt() is called by the application a second time with a buffer that is too small. A malicious attacker who is able present SM2 content for decryption to an application could cause attacker chosen data to overflow the buffer by up to a maximum of 62 bytes altering the contents of other data held after the buffer, possibly changing application behaviour or causing the application to crash. The location of the buffer is application dependent but is typically heap allocated. Fixed in OpenSSL 1.1.1l (Affected 1.1.1-1.1.1k).

Weakness: CWE-120

Which versions are affected by CVE-2021-3711?

3 open source packages ship an affected version, including openssl-src. It affects 31 products.

PackageAffectedFixed in
openssl-src crates.ioAll versions111.16.0
openssl-src crates.ioAll versions111.16.0
openssl-src crates.ioFrom 0.0.0-0111.16.0

Products include Debian Debian Linux, Netapp Active Iq Unified Manager, Netapp Clustered Data Ontap, Netapp Clustered Data Ontap Antivirus Connector, Netapp E-Series Santricity Os Controller, Netapp Hci Management Node and 25 more.

How do I fix CVE-2021-3711?

Upgrade openssl-src to 111.16.0 or later.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2021-3711 being exploited?

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

All Debian Debian Linux vulnerabilities

Sources

Also known as ALPINE-CVE-2021-3711, AZL-6779, CLEANSTART-2026-TN29223, CLSA-2023-1698949525, CLSA-2023-1699439565, DEBIAN-CVE-2021-3711 and 4 more.

Is CVE-2021-3711 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free