- Security fixes for 2024 * 0001-misc-Implement-grub_strlcpy.patch - Fix CVE-2024-45781 (bsc#1233617) * 0002-fs-ufs-Fix-a-heap-OOB-write.patch - Fix CVE-2024-56737 (bsc#1234958) - Fix CVE-2024-45782 (bsc#1233615) * 0003-fs-hfs-Fix-stack-OOB-write-with-grub_strcpy.patch - Fix CVE-2024-45780 (bsc#1233614) * 0004-fs-tar-Integer-overflow-leads-to-heap-OOB-write.patch - Fix CVE-2024-45783 (bsc#1233616) * 0005-fs-hfsplus-Set-a-grub_errno-if-mount-fails.patch * 0006-kern-file-Ensure-file-data-is-set.patch * 0007-kern-file-Implement-filesystem-reference-counting.patch - Fix CVE-2025-0624 (bsc#1236316) * 0008-net-Fix-OOB-write-in-grub_net_search_config_file.patch - Fix CVE-2024-45774 (bsc#1233609) * 0009-video-readers-jpeg-Do-not-permit-duplicate-SOF0-mark.patch - Fix CVE-2024-45775 (bsc#1233610) * 0010-commands-extcmd-Missing-check-for-failed-allocation.patch - Fix CVE-2025-0622 (bsc#1236317) * 0011-commands-pgp-Unregister-the-check_signatures-hooks-o.patch - Fix CVE-2025-0622 (bsc#1236317) * 0012-normal-Remove-variables-hooks-on-module-unload.patch - Fix CVE-2025-0622 (bsc#1236317) * 0013-gettext-Remove-variables-hooks-on-module-unload.patch - Fix CVE-2024-45776 (bsc#1233612) * 0014-gettext-Integer-overflow-leads-to-heap-OOB-write-or-.patch - Fix CVE-2024-45777 (bsc#1233613) * 0015-gettext-Integer-overflow-leads-to-heap-OOB-write.patch - Fix CVE-2025-0690 (bsc#1237012) OBS-URL: https://build.opensuse.org/request/show/1246819 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=528
73 lines
2.1 KiB
Diff
73 lines
2.1 KiB
Diff
From fd945966dc04c01765dcf129d8884f0b22991e74 Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Bar Or <jonathanbaror@gmail.com>
|
|
Date: Thu, 23 Jan 2025 19:17:05 +0100
|
|
Subject: [PATCH 16/20] commands/read: Fix an integer overflow when supplying
|
|
more than 2^31 characters
|
|
|
|
The grub_getline() function currently has a signed integer variable "i"
|
|
that can be overflown when user supplies more than 2^31 characters.
|
|
It results in a memory corruption of the allocated line buffer as well
|
|
as supplying large negative values to grub_realloc().
|
|
|
|
Fixes: CVE-2025-0690
|
|
|
|
Reported-by: Jonathan Bar Or <jonathanbaror@gmail.com>
|
|
Signed-off-by: Jonathan Bar Or <jonathanbaror@gmail.com>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
---
|
|
grub-core/commands/read.c | 19 +++++++++++++++----
|
|
1 file changed, 15 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/grub-core/commands/read.c b/grub-core/commands/read.c
|
|
index 9bbc523f6b..b8597692e2 100644
|
|
--- a/grub-core/commands/read.c
|
|
+++ b/grub-core/commands/read.c
|
|
@@ -26,6 +26,7 @@
|
|
#include <grub/types.h>
|
|
#include <grub/extcmd.h>
|
|
#include <grub/i18n.h>
|
|
+#include <grub/safemath.h>
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
@@ -38,13 +39,14 @@ static const struct grub_arg_option options[] =
|
|
static char *
|
|
grub_getline (int silent)
|
|
{
|
|
- int i;
|
|
+ grub_size_t i;
|
|
char *line;
|
|
char *tmp;
|
|
int c;
|
|
+ grub_size_t alloc_size;
|
|
|
|
i = 0;
|
|
- line = grub_malloc (1 + i + sizeof('\0'));
|
|
+ line = grub_malloc (1 + sizeof('\0'));
|
|
if (! line)
|
|
return NULL;
|
|
|
|
@@ -60,8 +62,17 @@ grub_getline (int silent)
|
|
line[i] = (char) c;
|
|
if (!silent)
|
|
grub_printf ("%c", c);
|
|
- i++;
|
|
- tmp = grub_realloc (line, 1 + i + sizeof('\0'));
|
|
+ if (grub_add (i, 1, &i))
|
|
+ {
|
|
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
|
+ return NULL;
|
|
+ }
|
|
+ if (grub_add (i, 1 + sizeof('\0'), &alloc_size))
|
|
+ {
|
|
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
|
+ return NULL;
|
|
+ }
|
|
+ tmp = grub_realloc (line, alloc_size);
|
|
if (! tmp)
|
|
{
|
|
grub_free (line);
|
|
--
|
|
2.48.1
|
|
|