diff options
author | Vijay Anusuri <vanusuri@mvista.com> | 2025-05-08 14:48:36 +0530 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2025-05-14 09:08:58 -0700 |
commit | c418c7ec51a5556054d0deb56dce08268da1983f (patch) | |
tree | ebfba15a6efd1b000ab36703974116d60c447eb3 | |
parent | 86ea2699ac0e8fddcd5b03e71e05556fe466627d (diff) | |
download | poky-c418c7ec51a5556054d0deb56dce08268da1983f.tar.gz |
libsoup: Fix CVE-2025-32914
Upstream-Status: Backport
[https://gitlab.gnome.org/GNOME/libsoup/-/commit/5bfcf8157597f2d327050114fb37ff600004dbcf]
(From OE-Core rev: 6dd125b619974c8102b3050900781c22c2db4b10)
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/recipes-support/libsoup/libsoup-3.4.4/CVE-2025-32914.patch | 111 | ||||
-rw-r--r-- | meta/recipes-support/libsoup/libsoup_3.4.4.bb | 1 |
2 files changed, 112 insertions, 0 deletions
diff --git a/meta/recipes-support/libsoup/libsoup-3.4.4/CVE-2025-32914.patch b/meta/recipes-support/libsoup/libsoup-3.4.4/CVE-2025-32914.patch new file mode 100644 index 0000000000..0ada9f3134 --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup-3.4.4/CVE-2025-32914.patch | |||
@@ -0,0 +1,111 @@ | |||
1 | From 5bfcf8157597f2d327050114fb37ff600004dbcf Mon Sep 17 00:00:00 2001 | ||
2 | From: Milan Crha <mcrha@redhat.com> | ||
3 | Date: Tue, 15 Apr 2025 09:03:00 +0200 | ||
4 | Subject: [PATCH] multipart: Fix read out of buffer bounds under | ||
5 | soup_multipart_new_from_message() | ||
6 | |||
7 | This is CVE-2025-32914, special crafted input can cause read out of buffer bounds | ||
8 | of the body argument. | ||
9 | |||
10 | Closes #436 | ||
11 | |||
12 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/5bfcf8157597f2d327050114fb37ff600004dbcf] | ||
13 | CVE: CVE-2025-32914 | ||
14 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
15 | --- | ||
16 | libsoup/soup-multipart.c | 2 +- | ||
17 | tests/multipart-test.c | 58 ++++++++++++++++++++++++++++++++++++++++ | ||
18 | 2 files changed, 59 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c | ||
21 | index 2421c91f8..102ce3722 100644 | ||
22 | --- a/libsoup/soup-multipart.c | ||
23 | +++ b/libsoup/soup-multipart.c | ||
24 | @@ -173,7 +173,7 @@ soup_multipart_new_from_message (SoupMessageHeaders *headers, | ||
25 | return NULL; | ||
26 | } | ||
27 | |||
28 | - split = strstr (start, "\r\n\r\n"); | ||
29 | + split = g_strstr_len (start, body_end - start, "\r\n\r\n"); | ||
30 | if (!split || split > end) { | ||
31 | soup_multipart_free (multipart); | ||
32 | return NULL; | ||
33 | diff --git a/tests/multipart-test.c b/tests/multipart-test.c | ||
34 | index 2c0e7e969..f5b986889 100644 | ||
35 | --- a/tests/multipart-test.c | ||
36 | +++ b/tests/multipart-test.c | ||
37 | @@ -471,6 +471,62 @@ test_multipart (gconstpointer data) | ||
38 | loop = NULL; | ||
39 | } | ||
40 | |||
41 | +static void | ||
42 | +test_multipart_bounds_good (void) | ||
43 | +{ | ||
44 | + #define TEXT "line1\r\nline2" | ||
45 | + SoupMultipart *multipart; | ||
46 | + SoupMessageHeaders *headers, *set_headers = NULL; | ||
47 | + GBytes *bytes, *set_bytes = NULL; | ||
48 | + const char *raw_data = "--123\r\nContent-Type: text/plain;\r\n\r\n" TEXT "\r\n--123--\r\n"; | ||
49 | + gboolean success; | ||
50 | + | ||
51 | + headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART); | ||
52 | + soup_message_headers_append (headers, "Content-Type", "multipart/mixed; boundary=\"123\""); | ||
53 | + | ||
54 | + bytes = g_bytes_new (raw_data, strlen (raw_data)); | ||
55 | + | ||
56 | + multipart = soup_multipart_new_from_message (headers, bytes); | ||
57 | + | ||
58 | + g_assert_nonnull (multipart); | ||
59 | + g_assert_cmpint (soup_multipart_get_length (multipart), ==, 1); | ||
60 | + success = soup_multipart_get_part (multipart, 0, &set_headers, &set_bytes); | ||
61 | + g_assert_true (success); | ||
62 | + g_assert_nonnull (set_headers); | ||
63 | + g_assert_nonnull (set_bytes); | ||
64 | + g_assert_cmpint (strlen (TEXT), ==, g_bytes_get_size (set_bytes)); | ||
65 | + g_assert_cmpstr ("text/plain", ==, soup_message_headers_get_content_type (set_headers, NULL)); | ||
66 | + g_assert_cmpmem (TEXT, strlen (TEXT), g_bytes_get_data (set_bytes, NULL), g_bytes_get_size (set_bytes)); | ||
67 | + | ||
68 | + soup_message_headers_unref (headers); | ||
69 | + g_bytes_unref (bytes); | ||
70 | + | ||
71 | + soup_multipart_free (multipart); | ||
72 | + | ||
73 | + #undef TEXT | ||
74 | +} | ||
75 | + | ||
76 | +static void | ||
77 | +test_multipart_bounds_bad (void) | ||
78 | +{ | ||
79 | + SoupMultipart *multipart; | ||
80 | + SoupMessageHeaders *headers; | ||
81 | + GBytes *bytes; | ||
82 | + const char *raw_data = "--123\r\nContent-Type: text/plain;\r\nline1\r\nline2\r\n--123--\r\n"; | ||
83 | + | ||
84 | + headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART); | ||
85 | + soup_message_headers_append (headers, "Content-Type", "multipart/mixed; boundary=\"123\""); | ||
86 | + | ||
87 | + bytes = g_bytes_new (raw_data, strlen (raw_data)); | ||
88 | + | ||
89 | + /* it did read out of raw_data/bytes bounds */ | ||
90 | + multipart = soup_multipart_new_from_message (headers, bytes); | ||
91 | + g_assert_null (multipart); | ||
92 | + | ||
93 | + soup_message_headers_unref (headers); | ||
94 | + g_bytes_unref (bytes); | ||
95 | +} | ||
96 | + | ||
97 | int | ||
98 | main (int argc, char **argv) | ||
99 | { | ||
100 | @@ -498,6 +554,8 @@ main (int argc, char **argv) | ||
101 | g_test_add_data_func ("/multipart/sync", GINT_TO_POINTER (SYNC_MULTIPART), test_multipart); | ||
102 | g_test_add_data_func ("/multipart/async", GINT_TO_POINTER (ASYNC_MULTIPART), test_multipart); | ||
103 | g_test_add_data_func ("/multipart/async-small-reads", GINT_TO_POINTER (ASYNC_MULTIPART_SMALL_READS), test_multipart); | ||
104 | + g_test_add_func ("/multipart/bounds-good", test_multipart_bounds_good); | ||
105 | + g_test_add_func ("/multipart/bounds-bad", test_multipart_bounds_bad); | ||
106 | |||
107 | ret = g_test_run (); | ||
108 | |||
109 | -- | ||
110 | GitLab | ||
111 | |||
diff --git a/meta/recipes-support/libsoup/libsoup_3.4.4.bb b/meta/recipes-support/libsoup/libsoup_3.4.4.bb index 63e9afa6fc..8cca980faf 100644 --- a/meta/recipes-support/libsoup/libsoup_3.4.4.bb +++ b/meta/recipes-support/libsoup/libsoup_3.4.4.bb | |||
@@ -29,6 +29,7 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \ | |||
29 | file://CVE-2025-32906-1.patch \ | 29 | file://CVE-2025-32906-1.patch \ |
30 | file://CVE-2025-32906-2.patch \ | 30 | file://CVE-2025-32906-2.patch \ |
31 | file://CVE-2025-46420.patch \ | 31 | file://CVE-2025-46420.patch \ |
32 | file://CVE-2025-32914.patch \ | ||
32 | " | 33 | " |
33 | SRC_URI[sha256sum] = "291c67725f36ed90ea43efff25064b69c5a2d1981488477c05c481a3b4b0c5aa" | 34 | SRC_URI[sha256sum] = "291c67725f36ed90ea43efff25064b69c5a2d1981488477c05c481a3b4b0c5aa" |
34 | 35 | ||