CVE-2021-3711
openssl: SM2 Decryption Buffer Overflow
Overview
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).
Source: OX vulnerability database
Severity
9.8 · CRITICAL
CVSS 3.1 base score, scored by NVD.
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness: CWE-120
Affected packages · 3
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| Cargo (Rust) | openssl-src | <111.16.0 | 111.16.0 |
| Conan (C/C++) | openssl | >=1.1.1 <1.1.1l | 1.1.1o |
| Julia | OpenSSL_jll | <1.1.13+0 | 1.1.13+0 |
Open a package to see all its vulnerabilities.
Operating systems · 32 fixes
Azure Linux 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 3.0 | edk2 | 0:20240223gitedc6681206c1-1.azl3 |
Photon OS 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 4.0 | openssl +4 | 1.1.1l-1.ph4 |
SUSE Linux Enterprise 2 releases · 3 packages
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 12.5 | libopenssl-1-1-devel +4 | 1.1.1d-2.36.2 | SUSE-SU-2021:2833-1 |
| 12.5 | golang-github-prometheus-node-exporter | 1.3.0-1.15.3 | SUSE-SU-2022:2134-1 |
| 15.4 | grafana | 8.5.13-150200.3.29.5 | SUSE-SU-2022:4428-1 |
SUSE Linux Enterprise Micro 1 release · 1 package
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 5.0 | libopenssl1-1 +1 | 1.1.1d-11.27.1 | SUSE-SU-2021:2830-1 |
alpine 4 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 3.22 | openssl | 1.1.1l-r0 |
| 3.23 | openssl | 1.1.1l-r0 |
| 3.24 | openssl | 1.1.1l-r0 |
| edge | openssl | 1.1.1l-r0 |
debian 5 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 10 | openssl | 1.1.1d-0+deb10u7 |
| 11 | openssl | 1.1.1k-1+deb11u1 |
| 12 | openssl | 1.1.1l-1 |
| 13 | openssl | 1.1.1l-1 |
| 14 | openssl | 1.1.1l-1 |
echo 1 release · 4 packages
| Release | Package | Fixed in |
|---|---|---|
| openssl-1-1-1c | 1.1.1c+e1 | |
| openssl-1-1-1g | 1.1.1g+e1 | |
| openssl-1-1-1k | 1.1.1k+e1 | |
| openssl | 1.1.1l-1 |
openSUSE 1 release · 3 packages
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Tumbleweed | grype +3 | 0.92.1-1.1 | openSUSE-SU-2025:15136-1 |
| Tumbleweed | libopenssl-1-1-devel +6 | 1.1.1l-1.2 | openSUSE-SU-2024:11127-1 |
| Tumbleweed | grafana | 8.3.4-1.1 | openSUSE-SU-2024:11816-1 |
root.io alpine 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 3.23 | rootio-openssl | 1.1.1l-r0 |
root.io debian 2 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 11 | rootio-openssl | 1.1.1k-1+deb11u1 |
| 12 | rootio-openssl | 1.1.1l-1 |
ubuntu 7 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 18.04 | openssl | 1.1.1-1ubuntu2.1~18.04.13 |
| 18.04-ESM | openssl | 1.1.1-1ubuntu2.1~18.04.13 |
| 20.04 | openssl | 1.1.1f-1ubuntu2.8 |
| 20.04-ESM | openssl | 1.1.1f-1ubuntu2.8 |
| 22.04 | openssl | 1.1.1l-1ubuntu1 |
| 24.04 | openssl | 1.1.1l-1ubuntu1 |
1 more row
References
- www.openwall.com http://www.openwall.com/lists/oss-security/2021/08/26/2
- access.redhat.com https://access.redhat.com/security/cve/CVE-2021-3711
- cert-portal.siemens.com https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf
- git.openssl.org https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=59f5e75f3bced8fc0e130d72a3f582cf7b480b46
- git.openssl.org https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=59f5e75f3bced8fc0e130d72a3f582cf7b480b46
- github.com https://github.com/advisories/GHSA-5ww6-px42-wc85
- lists.apache.org https://lists.apache.org/thread.html/r18995de860f0e63635f3008fd2a6aca82394249476d21691e7c59c9e%40%3Cdev.tomcat.apache.org%3E
- lists.apache.org https://lists.apache.org/thread.html/r18995de860f0e63635f3008fd2a6aca82394249476d21691e7c59c9e@%3Cdev.tomcat.apache.org%3E
- lists.apache.org https://lists.apache.org/thread.html/rad5d9f83f0d11fb3f8bb148d179b8a9ad7c6a17f18d70e5805a713d1%40%3Cdev.tomcat.apache.org%3E
- lists.apache.org https://lists.apache.org/thread.html/rad5d9f83f0d11fb3f8bb148d179b8a9ad7c6a17f18d70e5805a713d1@%3Cdev.tomcat.apache.org%3E
Show all 29 references
- nvd.nist.gov https://nvd.nist.gov/vuln/detail/CVE-2021-3711
- rustsec.org https://rustsec.org/advisories/RUSTSEC-2021-0097.html
- security.gentoo.org https://security.gentoo.org/glsa/202209-02
- security.gentoo.org https://security.gentoo.org/glsa/202210-02
- security.netapp.com https://security.netapp.com/advisory/ntap-20210827-0010
- security.netapp.com https://security.netapp.com/advisory/ntap-20210827-0010/
- security.netapp.com https://security.netapp.com/advisory/ntap-20211022-0003
- security.netapp.com https://security.netapp.com/advisory/ntap-20211022-0003/
- security.netapp.com https://security.netapp.com/advisory/ntap-20240621-0006
- security.netapp.com https://security.netapp.com/advisory/ntap-20240621-0006/
- ubuntu.com https://ubuntu.com/security/notices/USN-5051-1
- www.cve.org https://www.cve.org/CVERecord?id=CVE-2021-3711
- www.debian.org https://www.debian.org/security/2021/dsa-4963
- www.openssl.org https://www.openssl.org/news/secadv/20210824.txt
- www.oracle.com https://www.oracle.com/security-alerts/cpuapr2022.html
- www.oracle.com https://www.oracle.com/security-alerts/cpujan2022.html
- www.oracle.com https://www.oracle.com/security-alerts/cpuoct2021.html
- www.tenable.com https://www.tenable.com/security/tns-2021-16
- www.tenable.com https://www.tenable.com/security/tns-2022-02
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.