15 Star 6 Fork 58

src-openEuler/edk2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0067-NetworkPkg-DxeNetLib-SECURITY-PATCH-CVE-2023-45237-R.patch 2.23 KB
一键复制 编辑 原始数据 按行查看 历史
ShenYage 提交于 2025-02-28 21:59 +08:00 . fix some bugs for CVE-2023-45236、CVE-2023-45237
From e0bdb75c67290d6851a4d2509fcfafaf9ef0e696 Mon Sep 17 00:00:00 2001
From: ShenYage <shenyage1@huawei.com>
Date: Fri, 28 Feb 2025 16:18:39 +0800
Subject: [PATCH 2/2] NetworkPkg: DxeNetLib: SECURITY PATCH CVE-2023-45237
Relared Patch
This commit is a patch for CVE-2023-45237. Using RngLib to generate a stronger pseudoRandom number for NetRandomInitSeed().
Signed-off-by: ShenYage <shenyage1@huawei.com>
---
NetworkPkg/Library/DxeNetLib/DxeNetLib.c | 18 ++++++++++++------
NetworkPkg/Library/DxeNetLib/DxeNetLib.inf | 1 +
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/NetworkPkg/Library/DxeNetLib/DxeNetLib.c b/NetworkPkg/Library/DxeNetLib/DxeNetLib.c
index fd4a9e15..d24038e8 100644
--- a/NetworkPkg/Library/DxeNetLib/DxeNetLib.c
+++ b/NetworkPkg/Library/DxeNetLib/DxeNetLib.c
@@ -31,6 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiLib.h>
+#include <Library/RngLib.h>
#define NIC_ITEM_CONFIG_SIZE (sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * MAX_IP4_CONFIG_IN_VARIABLE)
#define DEFAULT_ZERO_START ((UINTN) ~0)
@@ -902,14 +903,19 @@ NetRandomInitSeed (
EFI_TIME Time;
UINT32 Seed;
UINT64 MonotonicCount;
+ UINT32 RandomVal;
- gRT->GetTime (&Time, NULL);
- Seed = (Time.Hour << 24 | Time.Day << 16 | Time.Minute << 8 | Time.Second);
- Seed ^= Time.Nanosecond;
- Seed ^= Time.Year << 7;
+ if (GetRandomNumber32(&RandomVal)) {
+ Seed = RandomVal;
+ } else {
+ gRT->GetTime (&Time, NULL);
+ Seed = (Time.Hour << 24 | Time.Day << 16 | Time.Minute << 8 | Time.Second);
+ Seed ^= Time.Nanosecond;
+ Seed ^= Time.Year << 7;
- gBS->GetNextMonotonicCount (&MonotonicCount);
- Seed += (UINT32)MonotonicCount;
+ gBS->GetNextMonotonicCount (&MonotonicCount);
+ Seed += (UINT32)MonotonicCount;
+ }
return Seed;
}
diff --git a/NetworkPkg/Library/DxeNetLib/DxeNetLib.inf b/NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
index 8145d256..ce90aa5e 100644
--- a/NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
+++ b/NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
@@ -43,6 +43,7 @@
MemoryAllocationLib
DevicePathLib
PrintLib
+ RngLib
[Guids]
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/edk2.git
git@gitee.com:src-openeuler/edk2.git
src-openeuler
edk2
edk2
master

搜索帮助