CVE-2021-3711 SM2 Decryption Buffer Overflow
SM2 복호화 버퍼 오버플로
설명
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).
SM2 암호화 된 데이터를 해독하기 위해 응용 프로그램은 API 함수 EVP_PKEY_decrypt ()를 호출해야합니다. 일반적으로 응용 프로그램은이 기능을 두 번 호출 합니다. 처음으로, 엔트리에서, "out" 파라미터는 NULL일 수 있고, 종료시, "outlen" 파라미터는 해독된 플레인텍스트를 보유하는데 필요한 버퍼 사이즈로 채워진다. 그런 다음 응용 프로그램은 충분히 큰 버퍼를 할당하고 EVP_PKEY_decrypt()를 다시 호출할 수 있지만 이번에는 "out" 매개 변수에 대해 NULL이 아닌 값을 전달합니다. SM2 복호화 코드의 구현에서의 버그는 EVP_PKEY_decrypt()에 대한 첫 번째 호출에 의해 반환된 플레인텍스트를 유지하는 데 필요한 버퍼 크기의 계산이 두 번째 호출에 필요한 실제 크기보다 작을 수 있음을 의미합니다. 이것은 너무 작은 버퍼를 가진 두 번째 애플리케이션에서 EVP_PKEY_decrypt()를 호출할 때 버퍼 오버플로우로 이어질 수 있습니다. 애플리케이션에 SM2 콘텐츠를 제공할 수 있는 악의적인 공격자는 공격자가 선택한 데이터가 버퍼에 최대 62바이트까지 오버플로우되어 애플리케이션 동작을 변경하거나 애플리케이션 충돌을 일으킬 수 있습니다. 버퍼의 위치는 애플리케이션에 따라 다르지만 일반적으로 힙 할당이 됩니다. OpenSSL 1.1.1l (에 영향을 미치는 1.1.1-1.1.1k)에서 수정.
영향 받는 제품 제품 2개
-
OpenSSL
OpenSSL
영향 받는 버전
- 버전 정보 확인 필요
해결 버전
해결된 버전 정보가 없습니다.
-
NVD 기준 해결 버전 있음
openssl
openssl
영향 받는 버전
- 1.1.1 이상 1.1.1l 미만
해결 버전
- 1.1.1l 이상
참고 자료 17건
- 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 (새 창)
- 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/rad5d9f83f0d11fb3f8bb148d179b8a9ad7c6a17f18d70e5805a713d1%40%3Cdev.tomcat.apache.org%3E (새 창)
- 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-20211022-0003/ (새 창)
- security.netapp.com https://security.netapp.com/advisory/ntap-20240621-0006/ (새 창)
- debian.org https://www.debian.org/security/2021/dsa-4963 (새 창)
- openssl.org https://www.openssl.org/news/secadv/20210824.txt (새 창)
- oracle.com https://www.oracle.com/security-alerts/cpuapr2022.html (새 창)
- oracle.com https://www.oracle.com/security-alerts/cpujan2022.html (새 창)
- oracle.com https://www.oracle.com/security-alerts/cpuoct2021.html (새 창)
- tenable.com https://www.tenable.com/security/tns-2021-16 (새 창)
- tenable.com https://www.tenable.com/security/tns-2022-02 (새 창)
- openwall.com http://www.openwall.com/lists/oss-security/2021/08/26/2 (새 창)