cbcvebase.
CVE-2021-3711
published 2021-08-24

CVE-2021-3711: 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…

PriorityP272critical9.8CVSS 3.1
AVNACLPRNUINSUCHIHAH
EPSS
87.82%
99.7th percentile
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

46 ranges· showing 25
VendorProductVersion rangeFixed in
debiandebian_linux
debiandebian_linux
debianopenssl< openssl 1.1.1l-1 (bookworm)openssl 1.1.1l-1 (bookworm)
msrcmicrosoft_visual_studio_2017_version_15.9
msrcmicrosoft_visual_studio_2019_version_16.11
msrcmicrosoft_visual_studio_2019_version_16.7
msrcmicrosoft_visual_studio_2019_version_16.9
msrcmicrosoft_visual_studio_2022_version_17.0
msrcmicrosoft_visual_studio_2022_version_17.1
netappe-series_santricity_os_controller11.0 – 11.50.2
opensslopenssl
opensslopenssl>= 0 < 1.1.1k-1+deb11u11.1.1k-1+deb11u1
opensslopenssl>= 0 < 1.1.1l-11.1.1l-1
opensslopenssl>= 0 < 1.1.1l-11.1.1l-1
opensslopenssl>= 0 < 1.1.1l-11.1.1l-1
opensslopenssl>= 0 < 1.1.1-1ubuntu2.1~18.04.131.1.1-1ubuntu2.1~18.04.13
opensslopenssl>= 0 < 1.1.1f-1ubuntu2.81.1.1f-1ubuntu2.8
opensslopenssl>= 1.1.1 < 1.1.1l1.1.1l
oraclecommunications_cloud_native_core_security_edge_protection_proxy
oraclecommunications_cloud_native_core_unified_data_repository
oraclecommunications_session_border_controller
oraclecommunications_session_border_controller
oraclecommunications_unified_session_manager
oraclecommunications_unified_session_manager
oracleenterprise_communications_broker

Detection & IOCsextracted from sources · hover to see the quote

  • Target the SM2 decryption path in OpenSSL: attacker-supplied SM2 ciphertext can overflow a heap buffer by up to 62 bytes when EVP_PKEY_decrypt() is called a second time with an undersized output buffer.
  • Monitor for exploitation of the EVP_PKEY_decrypt() API with SM2 content; the vulnerability is triggered by the two-call pattern where the first call returns an undersized buffer length and the second call overflows it.
  • Flag OpenSSL versions 1.1.1 through 1.1.1k in asset inventory as vulnerable; fixed version is 1.1.1l.
  • FreeBSD systems on stable/13 prior to commit 9d31ae318711 and releng/13.0 prior to 2261c814b7fa, and stable/12 prior to r370385 / releng/12.2 prior to r370396 are vulnerable; use these commit hashes/revision numbers to confirm patch status.
  • AVEVA InTouch Access Anywhere (versions 2023 and prior) and Plant SCADA Access Anywhere (versions 2020 R2 and prior) ship vulnerable OpenSSL builds; detect these products on the network as high-priority patching targets for CVE-2021-3711.
  • Siemens BFCClient versions prior to 2.17 contain the vulnerable OpenSSL SM2 decryption code; flag these in ICS/OT asset inventories.
  • ·The overflow is heap-based and application-dependent; the buffer location and exploitability vary by how the calling application allocates memory around the EVP_PKEY_decrypt() two-call pattern.
  • ·The vulnerability is only reachable in applications that use OpenSSL's SM2 decryption functionality; applications not processing SM2 ciphertext are not affected by this specific overflow.
  • ·Microsoft Visual Studio also ships the vulnerable OpenSSL; the MSRC entry confirms public disclosure status is 'No' and exploitation status is 'No' as of advisory date, but the issue is publicly known.

CVSS provenance

nvdv3.19.8CRITICALCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
nvdv2.07.5HIGHAV:N/AC:L/Au:N/C:P/I:P/A:P
osv9.8CRITICAL
vendor_debian9.8CRITICAL
vendor_msrc9.8CRITICAL
vendor_oracle9.8CRITICAL
vendor_redhat9.8CRITICAL
vendor_ubuntu9.8CRITICAL
Stop checking back — get the weekly exploitation signal.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.