Skip to content

Commit e7d414f

Browse files
[AutoPR- Security] Patch libsoup for CVE-2026-0716, CVE-2026-2443 [MEDIUM] (#15878)
Co-authored-by: akhila-guruju <v-guakhila@microsoft.com>
1 parent fb8871a commit e7d414f

6 files changed

Lines changed: 581 additions & 41 deletions

File tree

SPECS/libsoup/CVE-2025-32907.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ index 00000000..98f1c40f
144144
+ return;
145145
+ #endif
146146
+
147-
+ range = g_string_sized_new (99 * 1024);
147+
+ range = g_string_sized_new (60 * 1024);
148148
+ g_string_append (range, "bytes=1024");
149-
+ while (range->len < 99 * 1024)
149+
+ while (range->len < 60 * 1024)
150150
+ g_string_append (range, chunk);
151151
+
152152
+ session = soup_test_session_new (NULL);

SPECS/libsoup/CVE-2026-0716.patch

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
From cdb82443caf077486dfefa7db3057bd571e392c6 Mon Sep 17 00:00:00 2001
2+
From: Mike Gorse <mgorse@suse.com>
3+
Date: Mon, 2 Feb 2026 10:46:00 -0600
4+
Subject: [PATCH] websocket: Fix out-of-bounds read in process_frame
5+
6+
If the maximum incoming payload size is unset, then a malicious frame could
7+
cause an overflow when calculating the needed amount of data, leading to an
8+
out-of-bounds read later.
9+
10+
This is CVE-2026-0716.
11+
12+
Closes #476
13+
14+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
15+
Upstream-reference: https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/494.patch
16+
---
17+
libsoup/websocket/soup-websocket-connection.c | 6 +++
18+
tests/websocket-test.c | 44 +++++++++++++++++++
19+
2 files changed, 50 insertions(+)
20+
21+
diff --git a/libsoup/websocket/soup-websocket-connection.c b/libsoup/websocket/soup-websocket-connection.c
22+
index a185b5f..066720e 100644
23+
--- a/libsoup/websocket/soup-websocket-connection.c
24+
+++ b/libsoup/websocket/soup-websocket-connection.c
25+
@@ -1115,6 +1115,12 @@ process_frame (SoupWebsocketConnection *self)
26+
payload += 4;
27+
at += 4;
28+
29+
+ /* at has a maximum value of 10 + 4 = 14 */
30+
+ if (payload_len > G_MAXSIZE - 14) {
31+
+ bad_data_error_and_close (self);
32+
+ return FALSE;
33+
+ }
34+
+
35+
if (len < at + payload_len)
36+
return FALSE; /* need more data */
37+
38+
diff --git a/tests/websocket-test.c b/tests/websocket-test.c
39+
index 2dcbcb3..62a6850 100644
40+
--- a/tests/websocket-test.c
41+
+++ b/tests/websocket-test.c
42+
@@ -2244,6 +2244,41 @@ test_connection_error (void)
43+
soup_test_session_abort_unref (session);
44+
}
45+
46+
+static void
47+
+test_cve_2026_0716 (Test *test,
48+
+ gconstpointer unused)
49+
+{
50+
+ GError *error = NULL;
51+
+ GIOStream *io;
52+
+ gsize written;
53+
+ const char *frame;
54+
+ gboolean close_event = FALSE;
55+
+
56+
+ g_signal_handlers_disconnect_by_func (test->server, on_error_not_reached, NULL);
57+
+ g_signal_connect (test->server, "error", G_CALLBACK (on_error_copy), &error);
58+
+ g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event);
59+
+
60+
+ io = soup_websocket_connection_get_io_stream (test->client);
61+
+
62+
+ soup_websocket_connection_set_max_incoming_payload_size (test->server, 0);
63+
+
64+
+ // Malicious masked frame header (10-byte header + 4-byte mask) */
65+
+ frame = "\x82\xff\xff\xff\xff\xff\xff\xff\xff\xf6\xaa\xbb\xcc\xdd";
66+
+ if (!g_output_stream_write_all (g_io_stream_get_output_stream (io),
67+
+ frame, 14, &written, NULL, NULL))
68+
+ g_assert_cmpstr ("This code", ==, "should not be reached");
69+
+ g_assert_cmpuint (written, ==, 14);
70+
+
71+
+ WAIT_UNTIL (error != NULL);
72+
+ g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_BAD_DATA);
73+
+ g_clear_error (&error);
74+
+
75+
+ WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED);
76+
+ g_assert_true (close_event);
77+
+
78+
+ g_assert_cmpuint (soup_websocket_connection_get_close_code (test->client), ==, SOUP_WEBSOCKET_CLOSE_BAD_DATA);
79+
+}
80+
+
81+
int
82+
main (int argc,
83+
char *argv[])
84+
@@ -2521,6 +2556,15 @@ main (int argc,
85+
86+
g_test_add_func ("/websocket/soup/connection-error", test_connection_error);
87+
88+
+ g_test_add ("/websocket/direct/cve-2026-0716", Test, NULL,
89+
+ setup_direct_connection,
90+
+ test_cve_2026_0716,
91+
+ teardown_direct_connection);
92+
+ g_test_add ("/websocket/soup/cve-2026-0716", Test, NULL,
93+
+ setup_soup_connection,
94+
+ test_cve_2026_0716,
95+
+ teardown_soup_connection);
96+
+
97+
ret = g_test_run ();
98+
99+
test_cleanup ();
100+
--
101+
2.45.4
102+

SPECS/libsoup/CVE-2026-1536.patch

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ Upstream Patch Reference: https://gitlab.gnome.org/GNOME/libsoup/-/merge_request
2929
libsoup/soup-multipart.c | 4 +-
3030
libsoup/soup-session.c | 4 +-
3131
libsoup/websocket/soup-websocket.c | 28 +-
32-
tests/header-parsing-test.c | 257 +++++++++++++-----
32+
tests/header-parsing-test.c | 252 +++++++++++++-----
3333
tests/http2-test.c | 4 +-
34-
20 files changed, 317 insertions(+), 160 deletions(-)
34+
20 files changed, 311 insertions(+), 161 deletions(-)
3535

3636
diff --git a/libsoup/auth/soup-auth-manager.c b/libsoup/auth/soup-auth-manager.c
3737
index 402967d..1800190 100644
@@ -535,7 +535,7 @@ index 27257e4..c75b4da 100644
535535

536536
g_ptr_array_add (multipart->headers, headers);
537537
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
538-
index 9f00b05..0017cdb 100644
538+
index 649902f..4bca2a4 100644
539539
--- a/libsoup/soup-session.c
540540
+++ b/libsoup/soup-session.c
541541
@@ -1386,10 +1386,10 @@ soup_session_send_queue_item (SoupSession *session,
@@ -651,7 +651,7 @@ index 64e66fd..9863e94 100644
651651
soup_message_headers_remove_common (response_headers,
652652
SOUP_HEADER_SEC_WEBSOCKET_EXTENSIONS);
653653
diff --git a/tests/header-parsing-test.c b/tests/header-parsing-test.c
654-
index 5e423d2..e81d3b7 100644
654+
index 5e423d2..838baa6 100644
655655
--- a/tests/header-parsing-test.c
656656
+++ b/tests/header-parsing-test.c
657657
@@ -15,6 +15,7 @@ static struct RequestTest {
@@ -1038,7 +1038,7 @@ index 5e423d2..e81d3b7 100644
10381038
},
10391039

10401040
// https://gitlab.gnome.org/GNOME/libsoup/-/issues/377
1041-
@@ -437,15 +438,42 @@ static struct RequestTest {
1041+
@@ -437,15 +438,35 @@ static struct RequestTest {
10421042
"GET / HTTP/1.1\r\nHost\x00: example.com\r\n", 36,
10431043
SOUP_STATUS_BAD_REQUEST,
10441044
NULL, NULL, -1,
@@ -1051,39 +1051,33 @@ index 5e423d2..e81d3b7 100644
10511051
SOUP_STATUS_BAD_REQUEST,
10521052
NULL, NULL, -1,
10531053
- { { NULL } }
1054+
- }
10541055
+ { { NULL } }, 0
1055-
}
1056+
+ },
10561057
+
1057-
+ { "Only newlines", NULL,
1058-
+ only_newlines, sizeof (only_newlines),
1059-
+ SOUP_STATUS_BAD_REQUEST,
1060-
+ NULL, NULL, -1,
1061-
+ { { NULL } }, 0
1062-
+ },
1058+
+ { "Duplicate Host headers",
1059+
+ "https://gitlab.gnome.org/GNOME/libsoup/-/issues/472",
1060+
+ "GET / HTTP/1.1\r\nHost: example.com\r\nHost: example.org\r\n",
1061+
+ -1,
1062+
+ SOUP_STATUS_BAD_REQUEST,
1063+
+ NULL, NULL, -1,
1064+
+ { { NULL } },
1065+
+ G_LOG_LEVEL_WARNING
1066+
+ },
10631067
+
1064-
+ { "Duplicate Host headers",
1065-
+ "https://gitlab.gnome.org/GNOME/libsoup/-/issues/472",
1066-
+ "GET / HTTP/1.1\r\nHost: example.com\r\nHost: example.org\r\n",
1067-
+ -1,
1068-
+ SOUP_STATUS_BAD_REQUEST,
1069-
+ NULL, NULL, -1,
1070-
+ { { NULL } },
1071-
+ G_LOG_LEVEL_WARNING
1072-
+ },
1073-
+
1074-
+ { "Duplicate Host headers, case insensitive",
1075-
+ "https://gitlab.gnome.org/GNOME/libsoup/-/issues/472",
1076-
+ "GET / HTTP/1.1\r\nHost: example.com\r\nhost: example.org\r\n",
1077-
+ -1,
1078-
+ SOUP_STATUS_BAD_REQUEST,
1079-
+ NULL, NULL, -1,
1080-
+ { { NULL } },
1081-
+ G_LOG_LEVEL_WARNING
1082-
+ }
1068+
+ { "Duplicate Host headers, case insensitive",
1069+
+ "https://gitlab.gnome.org/GNOME/libsoup/-/issues/472",
1070+
+ "GET / HTTP/1.1\r\nHost: example.com\r\nhost: example.org\r\n",
1071+
+ -1,
1072+
+ SOUP_STATUS_BAD_REQUEST,
1073+
+ NULL, NULL, -1,
1074+
+ { { NULL } },
1075+
+ G_LOG_LEVEL_WARNING
1076+
+ }
10831077
};
10841078
static const int num_reqtests = G_N_ELEMENTS (reqtests);
10851079

1086-
@@ -892,10 +920,17 @@ do_request_tests (void)
1080+
@@ -892,10 +913,17 @@ do_request_tests (void)
10871081
len = strlen (reqtests[i].request);
10881082
else
10891083
len = reqtests[i].length;
@@ -1101,7 +1095,7 @@ index 5e423d2..e81d3b7 100644
11011095
if (SOUP_STATUS_IS_SUCCESSFUL (status)) {
11021096
g_assert_cmpstr (method, ==, reqtests[i].method);
11031097
g_assert_cmpstr (path, ==, reqtests[i].path);
1104-
@@ -1245,16 +1280,21 @@ do_append_param_tests (void)
1098+
@@ -1245,16 +1273,21 @@ do_append_param_tests (void)
11051099

11061100
static const struct {
11071101
const char *description, *name, *value;
@@ -1133,7 +1127,7 @@ index 5e423d2..e81d3b7 100644
11331127
};
11341128

11351129
static void
1136-
@@ -1264,15 +1304,105 @@ do_bad_header_tests (void)
1130+
@@ -1264,15 +1297,105 @@ do_bad_header_tests (void)
11371131
int i;
11381132

11391133
hdrs = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART);
@@ -1166,7 +1160,7 @@ index 5e423d2..e81d3b7 100644
11661160
+ soup_message_headers_append (hdrs, bad_header_values[i].name,
11671161
+ bad_header_values[i].value);
11681162
+ g_test_assert_expected_messages ();
1169-
}
1163+
+ }
11701164
+
11711165
+ /* soup_message_headers_replace: bad values */
11721166
+ for (i = 0; i < G_N_ELEMENTS (bad_header_values); i++) {
@@ -1177,7 +1171,7 @@ index 5e423d2..e81d3b7 100644
11771171
+ soup_message_headers_replace (hdrs, bad_header_values[i].name,
11781172
+ bad_header_values[i].value);
11791173
+ g_test_assert_expected_messages ();
1180-
+ }
1174+
}
11811175
+
11821176
+ /* soup_message_headers_set_content_type: bad values */
11831177
+ for (i = 0; i < G_N_ELEMENTS (bad_header_values); i++) {
@@ -1247,7 +1241,7 @@ index 5e423d2..e81d3b7 100644
12471241
soup_message_headers_unref (hdrs);
12481242
}
12491243

1250-
@@ -1291,6 +1421,7 @@ main (int argc, char **argv)
1244+
@@ -1291,6 +1414,7 @@ main (int argc, char **argv)
12511245
g_test_add_func ("/header-parsing/content-type", do_content_type_tests);
12521246
g_test_add_func ("/header-parsing/append-param", do_append_param_tests);
12531247
g_test_add_func ("/header-parsing/bad", do_bad_header_tests);
@@ -1271,5 +1265,5 @@ index 92944d6..6fa63e9 100644
12711265
} else if (strcmp (path, "/invalid-header-rfc9113") == 0) {
12721266
SoupMessageHeaders *response_headers;
12731267
--
1274-
2.45.4
1268+
2.43.0
12751269

0 commit comments

Comments
 (0)