diff options
| -rw-r--r-- | meta/recipes-support/libsoup/libsoup/CVE-2025-32914.patch | 111 | ||||
| -rw-r--r-- | meta/recipes-support/libsoup/libsoup_3.0.7.bb | 1 |
2 files changed, 112 insertions, 0 deletions
diff --git a/meta/recipes-support/libsoup/libsoup/CVE-2025-32914.patch b/meta/recipes-support/libsoup/libsoup/CVE-2025-32914.patch new file mode 100644 index 0000000000..0ada9f3134 --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup/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.0.7.bb b/meta/recipes-support/libsoup/libsoup_3.0.7.bb index dbf437c42f..87ffb34f7d 100644 --- a/meta/recipes-support/libsoup/libsoup_3.0.7.bb +++ b/meta/recipes-support/libsoup/libsoup_3.0.7.bb | |||
| @@ -29,6 +29,7 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \ | |||
| 29 | file://CVE-2025-32911_CVE-2025-32913-2.patch \ | 29 | file://CVE-2025-32911_CVE-2025-32913-2.patch \ |
| 30 | file://CVE-2025-32912-1.patch \ | 30 | file://CVE-2025-32912-1.patch \ |
| 31 | file://CVE-2025-32912-2.patch \ | 31 | file://CVE-2025-32912-2.patch \ |
| 32 | file://CVE-2025-32914.patch \ | ||
| 32 | " | 33 | " |
| 33 | SRC_URI[sha256sum] = "ebdf90cf3599c11acbb6818a9d9e3fc9d2c68e56eb829b93962972683e1bf7c8" | 34 | SRC_URI[sha256sum] = "ebdf90cf3599c11acbb6818a9d9e3fc9d2c68e56eb829b93962972683e1bf7c8" |
| 34 | 35 | ||
