* [PATCH v1 0/1] CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku
@ 2020-10-21 2:32 Kun Qin
2020-10-21 13:41 ` [edk2-devel] " Laszlo Ersek
0 siblings, 1 reply; 2+ messages in thread
From: Kun Qin @ 2020-10-21 2:32 UTC (permalink / raw)
To: devel; +Cc: Jian J Wang, Xiaoyu Lu, Jiewen Yao, Guomin Jiang
The issue is in VerifyEKUsInPkcs7Signature routine of
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c:
At the "Exit" portion of this routine, this function uses X509_free to free
SignerCert instance and PKCS7_free function to free Pkcs7. But SignerCert
is part of Pkcs7 instance, thus PKCS7_free will release the memory of
SignerCert for a second time with existed routine, which will cause page
fault if use-after-free guard is enabled.
The patch fix is to free Pkcs7 instance only using PKCS7_free.
Patch v1 branch: https://github.com/kuqin12/edk2/tree/buffer_double_free_v1
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Kun Qin <kun.q@outlook.com>
Kun Qin (1):
CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c | 4 ----
1 file changed, 4 deletions(-)
--
2.28.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [edk2-devel] [PATCH v1 0/1] CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku
2020-10-21 2:32 [PATCH v1 0/1] CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku Kun Qin
@ 2020-10-21 13:41 ` Laszlo Ersek
0 siblings, 0 replies; 2+ messages in thread
From: Laszlo Ersek @ 2020-10-21 13:41 UTC (permalink / raw)
To: devel, kun.q; +Cc: Jian J Wang, Xiaoyu Lu, Jiewen Yao, Guomin Jiang
On 10/21/20 04:32, Kun Qin wrote:
> The issue is in VerifyEKUsInPkcs7Signature routine of
> CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c:
>
>
> At the "Exit" portion of this routine, this function uses X509_free to free
> SignerCert instance and PKCS7_free function to free Pkcs7. But SignerCert
> is part of Pkcs7 instance, thus PKCS7_free will release the memory of
> SignerCert for a second time with existed routine, which will cause page
> fault if use-after-free guard is enabled.
>
>
> The patch fix is to free Pkcs7 instance only using PKCS7_free.
>
> Patch v1 branch: https://github.com/kuqin12/edk2/tree/buffer_double_free_v1
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
>
> Signed-off-by: Kun Qin <kun.q@outlook.com>
>
> Kun Qin (1):
> CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku
>
> CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c | 4 ----
> 1 file changed, 4 deletions(-)
>
Please run "BaseTools/Scripts/SetupGit.py" in your edk2 repository, for
setting some git configuration options that you are currently missing
(such as, handling of CRLF line terminators, shallow threading, ...)
Thanks
Laszlo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-21 13:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-21 2:32 [PATCH v1 0/1] CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku Kun Qin
2020-10-21 13:41 ` [edk2-devel] " Laszlo Ersek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox