summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoumya Sambu <soumya.sambu@windriver.com>2025-08-13 17:41:01 +0530
committerSteve Sakoman <steve@sakoman.com>2025-08-26 06:33:14 -0700
commit92ad2bf8854c616aaad3f40429ed2acc414fb027 (patch)
tree1615f0caf2205bc845c3d4b85bd2b587e384b694
parentf9e6c1011ae64054abfe4a58a1729419b43edf45 (diff)
downloadpoky-92ad2bf8854c616aaad3f40429ed2acc414fb027.tar.gz
elfutils: Fix CVE-2025-1376
A vulnerability classified as problematic was found in GNU elfutils 0.192. This vulnerability affects the function elf_strptr in the library /libelf/elf_strptr.c of the component eu-strip. The manipulation leads to denial of service. It is possible to launch the attack on the local host. The complexity of an attack is rather high. The exploitation appears to be difficult. The exploit has been disclosed to the public and may be used. The name of the patch is b16f441cca0a4841050e3215a9f120a6d8aea918. It is recommended to apply a patch to fix this issue. References: https://nvd.nist.gov/vuln/detail/CVE-2025-1376 https://ubuntu.com/security/CVE-2025-1376 Upstream patch: https://sourceware.org/git/?p=elfutils.git;a=commit;h=b16f441cca0a4841050e3215a9f120a6d8aea918 (From OE-Core rev: 603881e34e3bbb7435f0ae91553036eef7f1cb06) Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-devtools/elfutils/elfutils_0.192.bb1
-rw-r--r--meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch57
2 files changed, 58 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.192.bb b/meta/recipes-devtools/elfutils/elfutils_0.192.bb
index 4dcc774bb9..f8cf083ec6 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.192.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.192.bb
@@ -26,6 +26,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
26 file://CVE-2025-1365.patch \ 26 file://CVE-2025-1365.patch \
27 file://CVE-2025-1371.patch \ 27 file://CVE-2025-1371.patch \
28 file://CVE-2025-1372.patch \ 28 file://CVE-2025-1372.patch \
29 file://CVE-2025-1376.patch \
29 " 30 "
30SRC_URI:append:libc-musl = " \ 31SRC_URI:append:libc-musl = " \
31 file://0003-musl-utils.patch \ 32 file://0003-musl-utils.patch \
diff --git a/meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch b/meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch
new file mode 100644
index 0000000000..ebffb2bd72
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch
@@ -0,0 +1,57 @@
1From b16f441cca0a4841050e3215a9f120a6d8aea918 Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Thu, 13 Feb 2025 00:02:32 +0100
4Subject: [PATCH] libelf: Handle elf_strptr on section without any data
5
6In the unlikely situation that elf_strptr was called on a section with
7sh_size already set, but that doesn't have any data yet we could crash
8trying to verify the string to return.
9
10This could happen for example when a new section was created with
11elf_newscn, but no data having been added yet.
12
13 * libelf/elf_strptr.c (elf_strptr): Check strscn->rawdata_base
14 is not NULL.
15
16https://sourceware.org/bugzilla/show_bug.cgi?id=32672
17
18CVE: CVE-2025-1376
19
20Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=b16f441cca0a4841050e3215a9f120a6d8aea918]
21
22Signed-off-by: Mark Wielaard <mark@klomp.org>
23Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
24---
25 libelf/elf_strptr.c | 10 +++++++---
26 1 file changed, 7 insertions(+), 3 deletions(-)
27
28diff --git a/libelf/elf_strptr.c b/libelf/elf_strptr.c
29index c5a94f8..7be7f5e 100644
30--- a/libelf/elf_strptr.c
31+++ b/libelf/elf_strptr.c
32@@ -1,5 +1,6 @@
33 /* Return string pointer from string section.
34 Copyright (C) 1998-2002, 2004, 2008, 2009, 2015 Red Hat, Inc.
35+ Copyright (C) 2025 Mark J. Wielaard <mark@klomp.org>
36 This file is part of elfutils.
37 Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
38
39@@ -183,9 +184,12 @@ elf_strptr (Elf *elf, size_t idx, size_t offset)
40 // initialized yet (when data_read is zero). So we cannot just
41 // look at the rawdata.d.d_size.
42
43- /* Make sure the string is NUL terminated. Start from the end,
44- which very likely is a NUL char. */
45- if (likely (validate_str (strscn->rawdata_base, offset, sh_size)))
46+ /* First check there actually is any data. This could be a new
47+ section which hasn't had any data set yet. Then make sure
48+ the string is at a valid offset and NUL terminated. */
49+ if (unlikely (strscn->rawdata_base == NULL))
50+ __libelf_seterrno (ELF_E_INVALID_SECTION);
51+ else if (likely (validate_str (strscn->rawdata_base, offset, sh_size)))
52 result = &strscn->rawdata_base[offset];
53 else
54 __libelf_seterrno (ELF_E_INVALID_INDEX);
55--
562.43.2
57