diff options
| author | Changqing Li <changqing.li@windriver.com> | 2025-06-03 13:20:54 +0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-06-13 09:01:26 -0700 |
| commit | 2526655f7613098af2409367004785f5ab89fd83 (patch) | |
| tree | e4c58704c9bdeb99df7247794ccc9c461ea26b6b | |
| parent | c9de00a836f1ce4fb495ee24e9ffe5e0883b38cd (diff) | |
| download | poky-2526655f7613098af2409367004785f5ab89fd83.tar.gz | |
libsoup: fix CVE-2025-32914
Refer:
https://gitlab.gnome.org/GNOME/libsoup/-/issues/436
(From OE-Core rev: 323ee2ba9008eb1bdcd1082ca2a8952e30a8e333)
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-support/libsoup/libsoup/CVE-2025-32914.patch | 112 | ||||
| -rw-r--r-- | meta/recipes-support/libsoup/libsoup_3.6.5.bb | 3 |
2 files changed, 114 insertions, 1 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..c899347ebf --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup/CVE-2025-32914.patch | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | From 020d19f22b7e55f44febd17e237982665323e0bc 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 | CVE: CVE-2025-32914 | ||
| 13 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/450/diffs?commit_id=5bfcf8157597f2d327050114fb37ff600004dbcf] | ||
| 14 | |||
| 15 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
| 16 | --- | ||
| 17 | libsoup/soup-multipart.c | 2 +- | ||
| 18 | tests/multipart-test.c | 58 ++++++++++++++++++++++++++++++++++++++++ | ||
| 19 | 2 files changed, 59 insertions(+), 1 deletion(-) | ||
| 20 | |||
| 21 | diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c | ||
| 22 | index 2421c91..102ce37 100644 | ||
| 23 | --- a/libsoup/soup-multipart.c | ||
| 24 | +++ b/libsoup/soup-multipart.c | ||
| 25 | @@ -173,7 +173,7 @@ soup_multipart_new_from_message (SoupMessageHeaders *headers, | ||
| 26 | return NULL; | ||
| 27 | } | ||
| 28 | |||
| 29 | - split = strstr (start, "\r\n\r\n"); | ||
| 30 | + split = g_strstr_len (start, body_end - start, "\r\n\r\n"); | ||
| 31 | if (!split || split > end) { | ||
| 32 | soup_multipart_free (multipart); | ||
| 33 | return NULL; | ||
| 34 | diff --git a/tests/multipart-test.c b/tests/multipart-test.c | ||
| 35 | index 2c0e7e9..f5b9868 100644 | ||
| 36 | --- a/tests/multipart-test.c | ||
| 37 | +++ b/tests/multipart-test.c | ||
| 38 | @@ -471,6 +471,62 @@ test_multipart (gconstpointer data) | ||
| 39 | loop = NULL; | ||
| 40 | } | ||
| 41 | |||
| 42 | +static void | ||
| 43 | +test_multipart_bounds_good (void) | ||
| 44 | +{ | ||
| 45 | + #define TEXT "line1\r\nline2" | ||
| 46 | + SoupMultipart *multipart; | ||
| 47 | + SoupMessageHeaders *headers, *set_headers = NULL; | ||
| 48 | + GBytes *bytes, *set_bytes = NULL; | ||
| 49 | + const char *raw_data = "--123\r\nContent-Type: text/plain;\r\n\r\n" TEXT "\r\n--123--\r\n"; | ||
| 50 | + gboolean success; | ||
| 51 | + | ||
| 52 | + headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART); | ||
| 53 | + soup_message_headers_append (headers, "Content-Type", "multipart/mixed; boundary=\"123\""); | ||
| 54 | + | ||
| 55 | + bytes = g_bytes_new (raw_data, strlen (raw_data)); | ||
| 56 | + | ||
| 57 | + multipart = soup_multipart_new_from_message (headers, bytes); | ||
| 58 | + | ||
| 59 | + g_assert_nonnull (multipart); | ||
| 60 | + g_assert_cmpint (soup_multipart_get_length (multipart), ==, 1); | ||
| 61 | + success = soup_multipart_get_part (multipart, 0, &set_headers, &set_bytes); | ||
| 62 | + g_assert_true (success); | ||
| 63 | + g_assert_nonnull (set_headers); | ||
| 64 | + g_assert_nonnull (set_bytes); | ||
| 65 | + g_assert_cmpint (strlen (TEXT), ==, g_bytes_get_size (set_bytes)); | ||
| 66 | + g_assert_cmpstr ("text/plain", ==, soup_message_headers_get_content_type (set_headers, NULL)); | ||
| 67 | + g_assert_cmpmem (TEXT, strlen (TEXT), g_bytes_get_data (set_bytes, NULL), g_bytes_get_size (set_bytes)); | ||
| 68 | + | ||
| 69 | + soup_message_headers_unref (headers); | ||
| 70 | + g_bytes_unref (bytes); | ||
| 71 | + | ||
| 72 | + soup_multipart_free (multipart); | ||
| 73 | + | ||
| 74 | + #undef TEXT | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +static void | ||
| 78 | +test_multipart_bounds_bad (void) | ||
| 79 | +{ | ||
| 80 | + SoupMultipart *multipart; | ||
| 81 | + SoupMessageHeaders *headers; | ||
| 82 | + GBytes *bytes; | ||
| 83 | + const char *raw_data = "--123\r\nContent-Type: text/plain;\r\nline1\r\nline2\r\n--123--\r\n"; | ||
| 84 | + | ||
| 85 | + headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART); | ||
| 86 | + soup_message_headers_append (headers, "Content-Type", "multipart/mixed; boundary=\"123\""); | ||
| 87 | + | ||
| 88 | + bytes = g_bytes_new (raw_data, strlen (raw_data)); | ||
| 89 | + | ||
| 90 | + /* it did read out of raw_data/bytes bounds */ | ||
| 91 | + multipart = soup_multipart_new_from_message (headers, bytes); | ||
| 92 | + g_assert_null (multipart); | ||
| 93 | + | ||
| 94 | + soup_message_headers_unref (headers); | ||
| 95 | + g_bytes_unref (bytes); | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | int | ||
| 99 | main (int argc, char **argv) | ||
| 100 | { | ||
| 101 | @@ -498,6 +554,8 @@ main (int argc, char **argv) | ||
| 102 | g_test_add_data_func ("/multipart/sync", GINT_TO_POINTER (SYNC_MULTIPART), test_multipart); | ||
| 103 | g_test_add_data_func ("/multipart/async", GINT_TO_POINTER (ASYNC_MULTIPART), test_multipart); | ||
| 104 | g_test_add_data_func ("/multipart/async-small-reads", GINT_TO_POINTER (ASYNC_MULTIPART_SMALL_READS), test_multipart); | ||
| 105 | + g_test_add_func ("/multipart/bounds-good", test_multipart_bounds_good); | ||
| 106 | + g_test_add_func ("/multipart/bounds-bad", test_multipart_bounds_bad); | ||
| 107 | |||
| 108 | ret = g_test_run (); | ||
| 109 | |||
| 110 | -- | ||
| 111 | 2.34.1 | ||
| 112 | |||
diff --git a/meta/recipes-support/libsoup/libsoup_3.6.5.bb b/meta/recipes-support/libsoup/libsoup_3.6.5.bb index fbe9a79b0f..2faf50c223 100644 --- a/meta/recipes-support/libsoup/libsoup_3.6.5.bb +++ b/meta/recipes-support/libsoup/libsoup_3.6.5.bb | |||
| @@ -11,7 +11,8 @@ DEPENDS = "glib-2.0 glib-2.0-native libxml2 sqlite3 libpsl nghttp2" | |||
| 11 | 11 | ||
| 12 | SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}" | 12 | SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}" |
| 13 | 13 | ||
| 14 | SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz" | 14 | SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \ |
| 15 | file://CVE-2025-32914.patch" | ||
| 15 | SRC_URI[sha256sum] = "6891765aac3e949017945c3eaebd8cc8216df772456dc9f460976fbdb7ada234" | 16 | SRC_URI[sha256sum] = "6891765aac3e949017945c3eaebd8cc8216df772456dc9f460976fbdb7ada234" |
| 16 | 17 | ||
| 17 | PROVIDES = "libsoup-3.0" | 18 | PROVIDES = "libsoup-3.0" |
