Уязвимость переполнения буфера в процессе расшифровки данных с использованием SM2 из-за некорректного расчета размера буфера в OpenSSL
Описание
В процессе расшифровки данных, зашифрованных с помощью SM2, приложение использует API функцию EVP_PKEY_decrypt()
. Обычно приложение вызывает эту функцию дважды. При первом вызове параметр out
может быть равен NULL, и на выходе параметр outlen
заполняется размером буфера, необходимого для хранения расшифрованного текста. Затем приложение выделяет буфер соответствующего размера и вызывает EVP_PKEY_decrypt()
снова, на этот раз передавая ненулевое значение для параметра out
. Из-за ошибки в коде расшифровки SM2, расчет размера буфера, необходимого для хранения текста, который возвращается первым вызовом EVP_PKEY_decrypt()
, может оказаться меньше реального размера, требуемого для второго вызова. Это приводит к переполнению буфера при втором вызове EVP_PKEY_decrypt()
, если буфер оказывается слишком мал. Злоумышленник, способный предоставить специально подготовленные SM2-данные для расшифровки, может вызвать выполнение произвольного кода или нарушение работы приложения.
Тип уязвимости
Переполнение буфера
Ссылки
- Mailing ListThird Party Advisory
- Third Party Advisory
- Third Party Advisory
- Third Party Advisory
- Third Party Advisory
- Third Party Advisory
- Third Party Advisory
- Vendor Advisory
- PatchThird Party Advisory
- PatchThird Party Advisory
- PatchThird Party Advisory
- Third Party Advisory
- Third Party Advisory
- Mailing ListThird Party Advisory
- Third Party Advisory
Уязвимые конфигурации
Одно из
Одно из
Одно из
Одно из
EPSS
9.8 Critical
CVSS3
7.5 High
CVSS2
Дефекты
Связанные уязвимости
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 dat...
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 dat...
In order to decrypt SM2 encrypted data an application is expected to c ...
EPSS
9.8 Critical
CVSS3
7.5 High
CVSS2