Vulnerabilities / CVE-2021-3711

critical

CVE-2021-3711

openssl: SM2 Decryption Buffer Overflow

Published Modified CWE 120
In the Trivy database since at least 24 Oct 2026, 07:11 UTCWhen it arrived before that build is not recorded.

Severity by source

NVD9.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GHSA9.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Red Hat9.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Julia9.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Trivy's own label is CRITICAL. Rated critical by NVD, GHSA, Azure Linux, CBL-Mariner, Julia, Photon OS. Rated lower by Red Hat (high), Ubuntu (high).

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).

Affected packages and fixed versions

SourcePackageFixed in
Azure Linux 3.0edk20:20240223gitedc6681206c1-1.azl3
cargo::GitHub Security Advisory Rustopenssl-src111.16.0
CBL-Mariner 1.0openssl0:1.1.1k-8.cm1
CBL-Mariner 2.0openssl0:1.1.1k-11.cm2
julia::Julia Ecosystem Security AdvisoriesOpenSSL_jll1.1.13+0
Photon OS 2.0nxtgn-openssl1.1.1l-1.ph2
Photon OS 3.0nxtgn-openssl1.1.1l-1.ph3
Photon OS 4.0openssl, openssl-c_rehash, openssl-devel and 2 more1.1.1l-1.ph4
alpine 3.11openssl1.1.1l-r0
alpine 3.12openssl1.1.1l-r0
alpine 3.13openssl1.1.1l-r0
alpine 3.14openssl1.1.1l-r0
Show all 58 entries from 50 sources
SourcePackageFixed in
Azure Linux 3.0edk20:20240223gitedc6681206c1-1.azl3
cargo::GitHub Security Advisory Rustopenssl-src111.16.0
CBL-Mariner 1.0openssl0:1.1.1k-8.cm1
CBL-Mariner 2.0openssl0:1.1.1k-11.cm2
julia::Julia Ecosystem Security AdvisoriesOpenSSL_jll1.1.13+0
Photon OS 2.0nxtgn-openssl1.1.1l-1.ph2
Photon OS 3.0nxtgn-openssl1.1.1l-1.ph3
Photon OS 4.0openssl1.1.1l-1.ph4
Photon OS 4.0openssl-c_rehash1.1.1l-1.ph4
Photon OS 4.0openssl-devel1.1.1l-1.ph4
Photon OS 4.0openssl-docs1.1.1l-1.ph4
Photon OS 4.0openssl-perl1.1.1l-1.ph4
alpine 3.11openssl1.1.1l-r0
alpine 3.12openssl1.1.1l-r0
alpine 3.13openssl1.1.1l-r0
alpine 3.14openssl1.1.1l-r0
alpine 3.15openssl1.1.1l-r0
alpine 3.15openssl31.1.1l-r0
alpine 3.16openssl1.1.1l-r0
alpine 3.16openssl31.1.1l-r0
alpine 3.17openssl1.1.1l-r0
alpine 3.17openssl1.1-compat1.1.1l-r0
alpine 3.18openssl1.1.1l-r0
alpine 3.18openssl1.1-compat1.1.1l-r0
alpine 3.19openssl1.1.1l-r0
alpine 3.20openssl1.1.1l-r0
alpine 3.21openssl1.1.1l-r0
alpine 3.22openssl1.1.1l-r0
alpine 3.23openssl1.1.1l-r0
alpine 3.24openssl1.1.1l-r0
alpine edgeopenssl1.1.1l-r0
conan::GitLab Advisory Database Communityopenssl1.1.1o
debian 10openssl1.1.1d-0+deb10u7
debian 11openssl1.1.1k-1+deb11u1
debian 12openssl1.1.1l-1
debian 13openssl1.1.1l-1
debian 14openssl1.1.1l-1
echoopenssl1.1.1l-1
root.io alpine 3.18rootio-openssl1.1.1l-r0
root.io alpine 3.23rootio-openssl1.1.1l-r0
root.io debian 11rootio-openssl1.1.1k-1+deb11u1
root.io debian 12rootio-openssl1.1.1l-1
ubuntu 18.04openssl1.1.1-1ubuntu2.1~18.04.13
ubuntu 18.04-ESMopenssl1.1.1-1ubuntu2.1~18.04.13
ubuntu 20.04openssl1.1.1f-1ubuntu2.8
ubuntu 20.04-ESMopenssl1.1.1f-1ubuntu2.8
ubuntu 21.04openssl1.1.1j-1ubuntu3.5
ubuntu 21.10openssl1.1.1l-1ubuntu1
ubuntu 22.04openssl1.1.1l-1ubuntu1
ubuntu 22.10openssl1.1.1l-1ubuntu1
ubuntu 23.04openssl1.1.1l-1ubuntu1
ubuntu 23.10openssl1.1.1l-1ubuntu1
ubuntu 24.04openssl1.1.1l-1ubuntu1
ubuntu 24.10openssl1.1.1l-1ubuntu1
ubuntu 25.04openssl1.1.1l-1ubuntu1
ubuntu 25.10openssl1.1.1l-1ubuntu1
ubuntu 26.04openssl1.1.1l-1ubuntu1
ubuntu 26.10openssl1.1.1l-1ubuntu1

References

All 27 references

Vulnerability data compiled from the Trivy vulnerability database (trivy-db, Aqua Security, Apache License 2.0), which aggregates third-party advisories. CVE records are published by The MITRE Corporation under the CVE Terms of Use; CVE is a trademark of MITRE. This product uses data from the NVD API but is not endorsed or certified by the NVD. Severity, titles and advisory data from the GitHub Advisory Database (CC BY 4.0), Red Hat security data (CC BY 4.0) and the other sources linked on each entry. Entries may be summarised or re-formatted; the linked original is the authoritative record.