public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()
       [not found] <cover.1663837631.git.yi1.li@intel.com>
@ 2022-09-22 12:53 ` yi1 li
       [not found] ` <17172FDE2E57E722.30869@groups.io>
  1 sibling, 0 replies; 3+ messages in thread
From: yi1 li @ 2022-09-22 12:53 UTC (permalink / raw)
  To: devel; +Cc: Yi Li, Jiewen Yao, Jian J Wang, Xiaoyu Lu, Guomin Jiang

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4075

Fake BIO_snprintf() need to return error status -1. 0 will be
considered a correct return value, this may cause crash, please
refer to bugzilla link for details.

Signed-off-by: Yi Li <yi1.li@intel.com>

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
---
 CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index c1fc33538f..d7d8c206ed 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
@@ -494,7 +494,7 @@ BIO_snprintf (
   ...
   )
 {
-  return 0;
+  return -1;
 }
 
 #ifdef __GNUC__
-- 
2.31.1.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()
       [not found] ` <17172FDE2E57E722.30869@groups.io>
@ 2022-09-25  9:39   ` yi1 li
  2022-09-25  9:53     ` Yao, Jiewen
  0 siblings, 1 reply; 3+ messages in thread
From: yi1 li @ 2022-09-25  9:39 UTC (permalink / raw)
  To: devel@edk2.groups.io, Li, Yi1, Yao, Jiewen
  Cc: Wang, Jian J, Lu, Xiaoyu1, Jiang, Guomin

Hi Jiewen,
Can you take a look at this patch?
WPA3 Tls API fuzzing is blocked because of same pem API.

Thanks,
Yi

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of yi1 li
Sent: Thursday, September 22, 2022 8:53 PM
To: devel@edk2.groups.io
Cc: Li, Yi1 <yi1.li@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Lu, Xiaoyu1 <xiaoyu1.lu@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>
Subject: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4075

Fake BIO_snprintf() need to return error status -1. 0 will be considered a correct return value, this may cause crash, please refer to bugzilla link for details.

Signed-off-by: Yi Li <yi1.li@intel.com>

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
---
 CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index c1fc33538f..d7d8c206ed 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
@@ -494,7 +494,7 @@ BIO_snprintf (
   ...
   )
 {
-  return 0;
+  return -1;
 }
 
 #ifdef __GNUC__
--
2.31.1.windows.1







^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()
  2022-09-25  9:39   ` [edk2-devel] " yi1 li
@ 2022-09-25  9:53     ` Yao, Jiewen
  0 siblings, 0 replies; 3+ messages in thread
From: Yao, Jiewen @ 2022-09-25  9:53 UTC (permalink / raw)
  To: Li, Yi1, devel@edk2.groups.io; +Cc: Wang, Jian J, Lu, Xiaoyu1, Jiang, Guomin

Thanks. The solution looks good.

I recommend to add more comments below:
// Because the function does not actually print anything to buf, it returns -1 as error.
// Otherwise, the consumer may think that the buf is valid and parse the buffer.

With comment change, reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Li, Yi1 <yi1.li@intel.com>
> Sent: Sunday, September 25, 2022 5:40 PM
> To: devel@edk2.groups.io; Li, Yi1 <yi1.li@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Lu, Xiaoyu1
> <xiaoyu1.lu@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>
> Subject: RE: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-
> overflow due to BIO_snprintf()
> 
> Hi Jiewen,
> Can you take a look at this patch?
> WPA3 Tls API fuzzing is blocked because of same pem API.
> 
> Thanks,
> Yi
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of yi1 li
> Sent: Thursday, September 22, 2022 8:53 PM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 <yi1.li@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Wang,
> Jian J <jian.j.wang@intel.com>; Lu, Xiaoyu1 <xiaoyu1.lu@intel.com>; Jiang,
> Guomin <guomin.jiang@intel.com>
> Subject: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow
> due to BIO_snprintf()
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4075
> 
> Fake BIO_snprintf() need to return error status -1. 0 will be considered a
> correct return value, this may cause crash, please refer to bugzilla link for
> details.
> 
> Signed-off-by: Yi Li <yi1.li@intel.com>
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
> ---
>  CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> index c1fc33538f..d7d8c206ed 100644
> --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> @@ -494,7 +494,7 @@ BIO_snprintf (
>    ...
>    )
>  {
> -  return 0;
> +  return -1;
>  }
> 
>  #ifdef __GNUC__
> --
> 2.31.1.windows.1
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-25  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1663837631.git.yi1.li@intel.com>
2022-09-22 12:53 ` [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf() yi1 li
     [not found] ` <17172FDE2E57E722.30869@groups.io>
2022-09-25  9:39   ` [edk2-devel] " yi1 li
2022-09-25  9:53     ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox