summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorDivya Chellam <divya.chellam@windriver.com>2025-07-08 15:08:18 +0530
committerSteve Sakoman <steve@sakoman.com>2025-07-14 08:37:40 -0700
commit85c0d7d0aa9429859888216dee6e6a98d86a8d6e (patch)
treea7015f820964956fa5b5db6241b4108c30c997a4 /meta
parent6b95583a823da8f676cab720d660b16bc29ff89e (diff)
downloadpoky-85c0d7d0aa9429859888216dee6e6a98d86a8d6e.tar.gz
libarchive: fix CVE-2025-5917
A vulnerability has been identified in the libarchive library. This flaw involves an 'off-by- one' miscalculation when handling prefixes and suffixes for file names. This can lead to a 1- byte write overflow. While seemingly small, such an overflow can corrupt adjacent memory, lea ding to unpredictable program behavior, crashes, or in specific circumstances, could be lever aged as a building block for more sophisticated exploitation. Reference: https://security-tracker.debian.org/tracker/CVE-2025-5917 Upstream-patch: https://github.com/libarchive/libarchive/commit/7c02cde37a63580cd1859183fbbd2cf04a89be85 (From OE-Core rev: 2b2a2fce345c9bfcad44cc8ef3419f43dd07b022) Signed-off-by: Divya Chellam <divya.chellam@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-extended/libarchive/libarchive/CVE-2025-5917.patch54
-rw-r--r--meta/recipes-extended/libarchive/libarchive_3.6.2.bb1
2 files changed, 55 insertions, 0 deletions
diff --git a/meta/recipes-extended/libarchive/libarchive/CVE-2025-5917.patch b/meta/recipes-extended/libarchive/libarchive/CVE-2025-5917.patch
new file mode 100644
index 0000000000..9c2003e574
--- /dev/null
+++ b/meta/recipes-extended/libarchive/libarchive/CVE-2025-5917.patch
@@ -0,0 +1,54 @@
1From 7c02cde37a63580cd1859183fbbd2cf04a89be85 Mon Sep 17 00:00:00 2001
2From: Brian Campbell <Brian.Campbell@ed.ac.uk>
3Date: Sat, 26 Apr 2025 05:11:19 +0100
4Subject: [PATCH] Fix overflow in build_ustar_entry (#2588)
5
6The calculations for the suffix and prefix can increment the endpoint
7for a trailing slash. Hence the limits used should be one lower than the
8maximum number of bytes.
9
10Without this patch, when this happens for both the prefix and the
11suffix, we end up with 156 + 100 bytes, and the write of the null at the
12end will overflow the 256 byte buffer. This can be reproduced by running
13```
14mkdir -p foo/bar
15bsdtar cvf test.tar foo////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////bar
16```
17when bsdtar is compiled with Address Sanitiser, although I originally
18noticed this by accident with a genuine filename on a CHERI capability
19system, which faults immediately on the buffer overflow.
20
21CVE: CVE-2025-5917
22
23Upstream-Status: Backport [https://github.com/libarchive/libarchive/commit/7c02cde37a63580cd1859183fbbd2cf04a89be85]
24
25Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
26---
27 libarchive/archive_write_set_format_pax.c | 4 ++--
28 1 file changed, 2 insertions(+), 2 deletions(-)
29
30diff --git a/libarchive/archive_write_set_format_pax.c b/libarchive/archive_write_set_format_pax.c
31index cf1f477..8e6aade 100644
32--- a/libarchive/archive_write_set_format_pax.c
33+++ b/libarchive/archive_write_set_format_pax.c
34@@ -1546,7 +1546,7 @@ build_ustar_entry_name(char *dest, const char *src, size_t src_length,
35 const char *filename, *filename_end;
36 char *p;
37 int need_slash = 0; /* Was there a trailing slash? */
38- size_t suffix_length = 99;
39+ size_t suffix_length = 98; /* 99 - 1 for trailing slash */
40 size_t insert_length;
41
42 /* Length of additional dir element to be added. */
43@@ -1598,7 +1598,7 @@ build_ustar_entry_name(char *dest, const char *src, size_t src_length,
44 /* Step 2: Locate the "prefix" section of the dirname, including
45 * trailing '/'. */
46 prefix = src;
47- prefix_end = prefix + 155;
48+ prefix_end = prefix + 154 /* 155 - 1 for trailing / */;
49 if (prefix_end > filename)
50 prefix_end = filename;
51 while (prefix_end > prefix && *prefix_end != '/')
52--
532.40.0
54
diff --git a/meta/recipes-extended/libarchive/libarchive_3.6.2.bb b/meta/recipes-extended/libarchive/libarchive_3.6.2.bb
index f90063ba3a..3937bfb82d 100644
--- a/meta/recipes-extended/libarchive/libarchive_3.6.2.bb
+++ b/meta/recipes-extended/libarchive/libarchive_3.6.2.bb
@@ -38,6 +38,7 @@ SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz \
38 file://CVE-2025-5914.patch \ 38 file://CVE-2025-5914.patch \
39 file://CVE-2025-5915.patch \ 39 file://CVE-2025-5915.patch \
40 file://CVE-2025-5916.patch \ 40 file://CVE-2025-5916.patch \
41 file://CVE-2025-5917.patch \
41 " 42 "
42UPSTREAM_CHECK_URI = "http://libarchive.org/" 43UPSTREAM_CHECK_URI = "http://libarchive.org/"
43 44