OpenSSL: CVE-2021-3711 SM2 Decryption Buffer Overflow
CVE-2021-3711 is fixed in 3 products on 1 platform, first by libssl1.1 1.1.1-1ubuntu2.1~18.04.13, released August 23, 2021. It is not reported as exploited. Patch Radar priority: Urgent.
In order to decrypt SM2 encrypted data an application is expected to callthe API function EVP_PKEY_decrypt(). Typically an application will callthis function twice. The first time, on entry, the "out" parameter can beNULL and, on exit, the "outlen" parameter is populated with the buffer sizerequired to hold the decrypted plaintext. The application can then allocatea sufficiently sized buffer and call EVP_PKEY_decrypt() again, but thistime passing a non-NULL value for the "out" parameter. A bug in theimplementation of the SM2 decryption code means that the calculation of thebuffer size required to hold the plaintext returned by the first call toEVP_PKEY_decrypt() can be smaller than the actual size required by thesecond call. This can lead to a buffer overflow when EVP_PKEY_decrypt() iscalled by the application a second time with a buffer that is too small. Amalicious attacker who is able present SM2 content for decryption to anapplication could cause attacker chosen data to overflow the buffer by upto a maximum of 62 bytes altering the contents of other data held after thebuffer, possibly changing application behaviour or causing the applicationto crash. The location of the buffer is application dependent but istypically heap allocated. Fixed in OpenSSL 1.1.1l (Affected 1.1.1-1.1.1k).
Where it's fixed
| Product | Fixed in | Fix | Released |
|---|---|---|---|
| Linux | |||
| libssl1.1 · Ubuntu 18.04.6 LTS (bionic) | 1.1.1-1ubuntu2.1~18.04.13 | libssl1.1 1.1.1-1ubuntu2.1~18.04.13 | Aug 23, 2021 |
| libssl1.1 · Ubuntu 20.04 LTS (focal) | 1.1.1f-1ubuntu2.8 | libssl1.1 1.1.1f-1ubuntu2.8 | Aug 23, 2021 |
| libssl1.1 · Ubuntu 22.04.1 LTS (jammy) | 1.1.1l-1ubuntu1 | libssl1.1 1.1.1l-1ubuntu1 | Aug 23, 2021 |
| libssl3t64 · Ubuntu 24.10 (oracular) | 1.1.1l-1ubuntu1 | libssl3t64 1.1.1l-1ubuntu1 | Aug 24, 2021 |
| libssl3t64 · Ubuntu 25.04 (plucky) | 1.1.1l-1ubuntu1 | libssl3t64 1.1.1l-1ubuntu1 | Aug 24, 2021 |
| openssl · Ubuntu 18.04.6 LTS (bionic) | 1.1.1-1ubuntu2.1~18.04.13 | openssl 1.1.1-1ubuntu2.1~18.04.13 | Aug 23, 2021 |
| openssl · Ubuntu 20.04 LTS (focal) | 1.1.1f-1ubuntu2.8 | openssl 1.1.1f-1ubuntu2.8 | Aug 23, 2021 |
| openssl · Ubuntu 22.04.1 LTS (jammy) | 1.1.1l-1ubuntu1 | openssl 1.1.1l-1ubuntu1 | Aug 23, 2021 |
| openssl · Ubuntu 24.10 (oracular) | 1.1.1l-1ubuntu1 | openssl 1.1.1l-1ubuntu1 | Aug 24, 2021 |
| openssl · Ubuntu 25.04 (plucky) | 1.1.1l-1ubuntu1 | openssl 1.1.1l-1ubuntu1 | Aug 24, 2021 |
Patch Radar data is free to use with attribution. Terms and how to credit it.
Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.