diff options
author | Changqing Li <changqing.li@windriver.com> | 2025-05-08 17:54:28 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-12 22:01:55 +0100 |
commit | 1f881c0a6bf6eab9c664cc1fb19d1abfdb570464 (patch) | |
tree | d8d8f89ca284f4cb266c005769ba9b772b51865d | |
parent | d491b6303584033e6c49e886b4630096e8006294 (diff) | |
download | poky-1f881c0a6bf6eab9c664cc1fb19d1abfdb570464.tar.gz |
libsoup-2.4: fix CVE-2024-52532
CVE-2024-52532:
GNOME libsoup before 3.6.1 has an infinite loop, and memory consumption.
during the reading of certain patterns of WebSocket data from clients.
Refer:
https://nvd.nist.gov/vuln/detail/CVE-2024-52532
(From OE-Core rev: 4efb2f03cf47382bf79aec333109c78e309c337b)
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4 files changed, 132 insertions, 1 deletions
diff --git a/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-1.patch b/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-1.patch new file mode 100644 index 0000000000..cb1f096110 --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-1.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From a693d49bff058fc20a448dc4e7d324ff0dc6597e Mon Sep 17 00:00:00 2001 | ||
2 | From: Ignacio Casal Quinteiro <qignacio@amazon.com> | ||
3 | Date: Wed, 11 Sep 2024 11:52:11 +0200 | ||
4 | Subject: [PATCH 1/3] websocket: process the frame as soon as we read data | ||
5 | |||
6 | Otherwise we can enter in a read loop because we were not | ||
7 | validating the data until the all the data was read. | ||
8 | |||
9 | Fixes #391 | ||
10 | |||
11 | CVE: CVE-2024-52532 | ||
12 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/6adc0e3eb74c257ed4e2a23eb4b2774fdb0d67be#f1d67ca0386b145ea201cf88d27f72724d7c6715] | ||
13 | |||
14 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
15 | --- | ||
16 | libsoup/soup-websocket-connection.c | 5 ++--- | ||
17 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
18 | |||
19 | diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c | ||
20 | index a4095e1..65c1492 100644 | ||
21 | --- a/libsoup/soup-websocket-connection.c | ||
22 | +++ b/libsoup/soup-websocket-connection.c | ||
23 | @@ -1140,9 +1140,8 @@ soup_websocket_connection_read (SoupWebsocketConnection *self) | ||
24 | } | ||
25 | |||
26 | pv->incoming->len = len + count; | ||
27 | - } while (count > 0); | ||
28 | - | ||
29 | - process_incoming (self); | ||
30 | + process_incoming (self); | ||
31 | + } while (count > 0 && !pv->close_sent && !pv->io_closing); | ||
32 | |||
33 | if (end) { | ||
34 | if (!pv->close_sent || !pv->close_received) { | ||
35 | -- | ||
36 | 2.34.1 | ||
37 | |||
diff --git a/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-2.patch b/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-2.patch new file mode 100644 index 0000000000..dcadafe944 --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-2.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From f5b76410de1318f49844dacf6e68692522b6c856 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ignacio Casal Quinteiro <qignacio@amazon.com> | ||
3 | Date: Wed, 2 Oct 2024 11:17:19 +0200 | ||
4 | Subject: [PATCH] websocket-test: disconnect error copy after the test ends | ||
5 | |||
6 | Otherwise the server will have already sent a few more wrong | ||
7 | bytes and the client will continue getting errors to copy | ||
8 | but the error is already != NULL and it will assert | ||
9 | |||
10 | CVE: CVE-2024-52532 | ||
11 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/29b96fab2512666d7241e46c98cc45b60b795c0c] | ||
12 | |||
13 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
14 | --- | ||
15 | tests/websocket-test.c | 5 ++++- | ||
16 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
17 | |||
18 | diff --git a/tests/websocket-test.c b/tests/websocket-test.c | ||
19 | index 5e40cf3..1ec9ff6 100644 | ||
20 | --- a/tests/websocket-test.c | ||
21 | +++ b/tests/websocket-test.c | ||
22 | @@ -1331,8 +1331,9 @@ test_receive_invalid_encode_length_64 (Test *test, | ||
23 | GError *error = NULL; | ||
24 | InvalidEncodeLengthTest context = { test, NULL }; | ||
25 | guint i; | ||
26 | + guint error_id; | ||
27 | |||
28 | - g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); | ||
29 | + error_id = g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); | ||
30 | g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received); | ||
31 | |||
32 | /* We use 127(\x7f) as payload length with 65535 extended length */ | ||
33 | @@ -1345,6 +1346,7 @@ test_receive_invalid_encode_length_64 (Test *test, | ||
34 | WAIT_UNTIL (error != NULL || received != NULL); | ||
35 | g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); | ||
36 | g_clear_error (&error); | ||
37 | + g_signal_handler_disconnect (test->client, error_id); | ||
38 | g_assert_null (received); | ||
39 | |||
40 | g_thread_join (thread); | ||
41 | -- | ||
42 | 2.34.1 | ||
43 | |||
diff --git a/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-3.patch b/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-3.patch new file mode 100644 index 0000000000..ab6af72291 --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup-2.4/CVE-2024-52532-3.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From d97bb2e340f5a6d7e56a7738403f9d18bc406b70 Mon Sep 17 00:00:00 2001 | ||
2 | From: Simon McVittie <smcv@debian.org> | ||
3 | Date: Wed, 13 Nov 2024 14:14:23 +0000 | ||
4 | Subject: [PATCH 3/3] websocket-test: Disconnect error signal in another place | ||
5 | |||
6 | This is the same change as commit 29b96fab "websocket-test: disconnect | ||
7 | error copy after the test ends", and is done for the same reason, but | ||
8 | replicating it into a different function. | ||
9 | |||
10 | Fixes: 6adc0e3e "websocket: process the frame as soon as we read data" | ||
11 | Resolves: https://gitlab.gnome.org/GNOME/libsoup/-/issues/399 | ||
12 | Signed-off-by: Simon McVittie <smcv@debian.org> | ||
13 | |||
14 | CVE: CVE-2024-52532 | ||
15 | Upstream-Status: Backport | ||
16 | [https://gitlab.gnome.org/GNOME/libsoup/-/commit/4c9e75c6676a37b6485620c332e568e1a3f530ff] | ||
17 | |||
18 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
19 | --- | ||
20 | tests/websocket-test.c | 4 +++- | ||
21 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/tests/websocket-test.c b/tests/websocket-test.c | ||
24 | index 2b19a7b..0699a06 100644 | ||
25 | --- a/tests/websocket-test.c | ||
26 | +++ b/tests/websocket-test.c | ||
27 | @@ -1300,8 +1300,9 @@ test_receive_invalid_encode_length_16 (Test *test, | ||
28 | GError *error = NULL; | ||
29 | InvalidEncodeLengthTest context = { test, NULL }; | ||
30 | guint i; | ||
31 | + guint error_id; | ||
32 | |||
33 | - g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); | ||
34 | + error_id = g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); | ||
35 | g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received); | ||
36 | |||
37 | /* We use 126(~) as payload length with 125 extended length */ | ||
38 | @@ -1314,6 +1315,7 @@ test_receive_invalid_encode_length_16 (Test *test, | ||
39 | WAIT_UNTIL (error != NULL || received != NULL); | ||
40 | g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); | ||
41 | g_clear_error (&error); | ||
42 | + g_signal_handler_disconnect (test->client, error_id); | ||
43 | g_assert_null (received); | ||
44 | |||
45 | g_thread_join (thread); | ||
46 | -- | ||
47 | 2.34.1 | ||
48 | |||
diff --git a/meta/recipes-support/libsoup/libsoup-2.4_2.74.3.bb b/meta/recipes-support/libsoup/libsoup-2.4_2.74.3.bb index 5753ab2745..7e275a48f4 100644 --- a/meta/recipes-support/libsoup/libsoup-2.4_2.74.3.bb +++ b/meta/recipes-support/libsoup/libsoup-2.4_2.74.3.bb | |||
@@ -15,7 +15,10 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \ | |||
15 | file://0001-Fix-build-with-libxml2-2.12.0-and-clang-17.patch \ | 15 | file://0001-Fix-build-with-libxml2-2.12.0-and-clang-17.patch \ |
16 | file://0001-CVE-2025-32911.patch \ | 16 | file://0001-CVE-2025-32911.patch \ |
17 | file://0001-Fix-possibly-uninitialized-warnings.patch \ | 17 | file://0001-Fix-possibly-uninitialized-warnings.patch \ |
18 | file://0001-Remove-http-and-https-aliases-support-test.patch" | 18 | file://0001-Remove-http-and-https-aliases-support-test.patch \ |
19 | file://CVE-2024-52532-1.patch \ | ||
20 | file://CVE-2024-52532-2.patch \ | ||
21 | file://CVE-2024-52532-3.patch" | ||
19 | 22 | ||
20 | SRC_URI[sha256sum] = "e4b77c41cfc4c8c5a035fcdc320c7bc6cfb75ef7c5a034153df1413fa1d92f13" | 23 | SRC_URI[sha256sum] = "e4b77c41cfc4c8c5a035fcdc320c7bc6cfb75ef7c5a034153df1413fa1d92f13" |
21 | 24 | ||