diff options
| author | Hongxu Jia <hongxu.jia@windriver.com> | 2025-02-19 16:18:16 +0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-02-28 06:51:35 -0800 |
| commit | c54a2f894e1195bba6cd75358a729a2f4ec93398 (patch) | |
| tree | 87cb0629ce53e0dc17b7b515cd3c947704e3d7ba /meta | |
| parent | 7e46bdecf4796f354a269c7b7831499c9341f22e (diff) | |
| download | poky-c54a2f894e1195bba6cd75358a729a2f4ec93398.tar.gz | |
u-boot: fix CVE-2024-57256
An integer overflow in ext4fs_read_symlink in Das U-Boot before 2025.01-rc1
occurs for zalloc (adding one to an le32 variable) via a crafted ext4
filesystem with an inode size of 0xffffffff, resulting in a malloc of
zero and resultant memory overwrite.
https://nvd.nist.gov/vuln/detail/CVE-2024-57256
(From OE-Core rev: 534aa63726f31241e3a9d4aa70d4005fa0300133)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-bsp/u-boot/files/CVE-2024-57256.patch | 51 | ||||
| -rw-r--r-- | meta/recipes-bsp/u-boot/u-boot_2022.01.bb | 1 |
2 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-bsp/u-boot/files/CVE-2024-57256.patch b/meta/recipes-bsp/u-boot/files/CVE-2024-57256.patch new file mode 100644 index 0000000000..78cf4ac225 --- /dev/null +++ b/meta/recipes-bsp/u-boot/files/CVE-2024-57256.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From 49cab731abe7a98db4ac16666e3b5ab3bc799282 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Richard Weinberger <richard@nod.at> | ||
| 3 | Date: Fri, 9 Aug 2024 11:54:28 +0200 | ||
| 4 | Subject: [PATCH 3/8] ext4: Fix integer overflow in ext4fs_read_symlink() | ||
| 5 | |||
| 6 | While zalloc() takes a size_t type, adding 1 to the le32 variable | ||
| 7 | will overflow. | ||
| 8 | A carefully crafted ext4 filesystem can exhibit an inode size of 0xffffffff | ||
| 9 | and as consequence zalloc() will do a zero allocation. | ||
| 10 | |||
| 11 | Later in the function the inode size is again used for copying data. | ||
| 12 | So an attacker can overwrite memory. | ||
| 13 | |||
| 14 | Avoid the overflow by using the __builtin_add_overflow() helper. | ||
| 15 | |||
| 16 | Signed-off-by: Richard Weinberger <richard@nod.at> | ||
| 17 | |||
| 18 | CVE: CVE-2024-57256 | ||
| 19 | Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/35f75d2a46e5859138c83a75cd2f4141c5479ab9] | ||
| 20 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 21 | --- | ||
| 22 | fs/ext4/ext4_common.c | 7 ++++++- | ||
| 23 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
| 24 | |||
| 25 | diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c | ||
| 26 | index f50de7c0..a7798296 100644 | ||
| 27 | --- a/fs/ext4/ext4_common.c | ||
| 28 | +++ b/fs/ext4/ext4_common.c | ||
| 29 | @@ -2188,13 +2188,18 @@ static char *ext4fs_read_symlink(struct ext2fs_node *node) | ||
| 30 | struct ext2fs_node *diro = node; | ||
| 31 | int status; | ||
| 32 | loff_t actread; | ||
| 33 | + size_t alloc_size; | ||
| 34 | |||
| 35 | if (!diro->inode_read) { | ||
| 36 | status = ext4fs_read_inode(diro->data, diro->ino, &diro->inode); | ||
| 37 | if (status == 0) | ||
| 38 | return NULL; | ||
| 39 | } | ||
| 40 | - symlink = zalloc(le32_to_cpu(diro->inode.size) + 1); | ||
| 41 | + | ||
| 42 | + if (__builtin_add_overflow(le32_to_cpu(diro->inode.size), 1, &alloc_size)) | ||
| 43 | + return NULL; | ||
| 44 | + | ||
| 45 | + symlink = zalloc(alloc_size); | ||
| 46 | if (!symlink) | ||
| 47 | return NULL; | ||
| 48 | |||
| 49 | -- | ||
| 50 | 2.34.1 | ||
| 51 | |||
diff --git a/meta/recipes-bsp/u-boot/u-boot_2022.01.bb b/meta/recipes-bsp/u-boot/u-boot_2022.01.bb index cfe36256f3..c643fb35f3 100644 --- a/meta/recipes-bsp/u-boot/u-boot_2022.01.bb +++ b/meta/recipes-bsp/u-boot/u-boot_2022.01.bb | |||
| @@ -13,6 +13,7 @@ SRC_URI += " file://0001-riscv32-Use-double-float-ABI-for-rv32.patch \ | |||
| 13 | file://CVE-2022-2347_2.patch \ | 13 | file://CVE-2022-2347_2.patch \ |
| 14 | file://CVE-2024-57254.patch \ | 14 | file://CVE-2024-57254.patch \ |
| 15 | file://CVE-2024-57255.patch \ | 15 | file://CVE-2024-57255.patch \ |
| 16 | file://CVE-2024-57256.patch \ | ||
| 16 | " | 17 | " |
| 17 | 18 | ||
| 18 | DEPENDS += "bc-native dtc-native python3-setuptools-native" | 19 | DEPENDS += "bc-native dtc-native python3-setuptools-native" |
