diff options
| author | Changqing Li <changqing.li@windriver.com> | 2025-07-08 16:31:13 +0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-07-14 08:37:40 -0700 |
| commit | def97edcef31f0bfdea674de70684bcbd1b2e134 (patch) | |
| tree | bcbda1e76c10159b7f11bb3c0adbed490c8db41e | |
| parent | 65b15876278c95f574ae6cd53f48938b3b9ad415 (diff) | |
| download | poky-def97edcef31f0bfdea674de70684bcbd1b2e134.tar.gz | |
libsoup: fix CVE-2025-4945
Refer:
https://gitlab.gnome.org/GNOME/libsoup/-/issues/448
(From OE-Core rev: cd589717c05b887986b9d61f5193e764f4deb3ee)
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-4945.patch | 118 | ||||
| -rw-r--r-- | meta/recipes-support/libsoup/libsoup_3.0.7.bb | 1 |
2 files changed, 119 insertions, 0 deletions
diff --git a/meta/recipes-support/libsoup/libsoup/CVE-2025-4945.patch b/meta/recipes-support/libsoup/libsoup/CVE-2025-4945.patch new file mode 100644 index 0000000000..cb6640a6c6 --- /dev/null +++ b/meta/recipes-support/libsoup/libsoup/CVE-2025-4945.patch | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | From ee76a57af0e9fe1e43d3ab5a146a3da233573819 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Milan Crha <mcrha@redhat.com> | ||
| 3 | Date: Thu, 15 May 2025 07:59:14 +0200 | ||
| 4 | Subject: [PATCH] soup-date-utils: Add value checks for date/time parsing | ||
| 5 | |||
| 6 | Reject date/time when it does not represent a valid value. | ||
| 7 | |||
| 8 | Closes https://gitlab.gnome.org/GNOME/libsoup/-/issues/448 | ||
| 9 | |||
| 10 | CVE: CVE-2025-4945 | ||
| 11 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libsoup/-/commit/8988379984e33dcc7d3aa58551db13e48755959f] | ||
| 12 | |||
| 13 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
| 14 | --- | ||
| 15 | libsoup/soup-date-utils.c | 23 +++++++++++++++-------- | ||
| 16 | tests/cookies-test.c | 10 ++++++++++ | ||
| 17 | 2 files changed, 25 insertions(+), 8 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/libsoup/soup-date-utils.c b/libsoup/soup-date-utils.c | ||
| 20 | index 061057e..43616d6 100644 | ||
| 21 | --- a/libsoup/soup-date-utils.c | ||
| 22 | +++ b/libsoup/soup-date-utils.c | ||
| 23 | @@ -138,7 +138,7 @@ parse_day (int *day, const char **date_string) | ||
| 24 | while (*end == ' ' || *end == '-') | ||
| 25 | end++; | ||
| 26 | *date_string = end; | ||
| 27 | - return TRUE; | ||
| 28 | + return *day >= 1 && *day <= 31; | ||
| 29 | } | ||
| 30 | |||
| 31 | static inline gboolean | ||
| 32 | @@ -178,7 +178,7 @@ parse_year (int *year, const char **date_string) | ||
| 33 | while (*end == ' ' || *end == '-') | ||
| 34 | end++; | ||
| 35 | *date_string = end; | ||
| 36 | - return TRUE; | ||
| 37 | + return *year > 0 && *year < 9999; | ||
| 38 | } | ||
| 39 | |||
| 40 | static inline gboolean | ||
| 41 | @@ -202,7 +202,7 @@ parse_time (int *hour, int *minute, int *second, const char **date_string) | ||
| 42 | while (*p == ' ') | ||
| 43 | p++; | ||
| 44 | *date_string = p; | ||
| 45 | - return TRUE; | ||
| 46 | + return *hour >= 0 && *hour < 24 && *minute >= 0 && *minute < 60 && *second >= 0 && *second < 60; | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline gboolean | ||
| 50 | @@ -218,9 +218,14 @@ parse_timezone (GTimeZone **timezone, const char **date_string) | ||
| 51 | gulong val; | ||
| 52 | int sign = (**date_string == '+') ? 1 : -1; | ||
| 53 | val = strtoul (*date_string + 1, (char **)date_string, 10); | ||
| 54 | - if (**date_string == ':') | ||
| 55 | - val = 60 * val + strtoul (*date_string + 1, (char **)date_string, 10); | ||
| 56 | - else | ||
| 57 | + if (val > 9999) | ||
| 58 | + return FALSE; | ||
| 59 | + if (**date_string == ':') { | ||
| 60 | + gulong val2 = strtoul (*date_string + 1, (char **)date_string, 10); | ||
| 61 | + if (val > 99 || val2 > 99) | ||
| 62 | + return FALSE; | ||
| 63 | + val = 60 * val + val2; | ||
| 64 | + } else | ||
| 65 | val = 60 * (val / 100) + (val % 100); | ||
| 66 | offset_minutes = sign * val; | ||
| 67 | utc = (sign == -1) && !val; | ||
| 68 | @@ -273,7 +278,8 @@ parse_textual_date (const char *date_string) | ||
| 69 | if (!parse_month (&month, &date_string) || | ||
| 70 | !parse_day (&day, &date_string) || | ||
| 71 | !parse_time (&hour, &minute, &second, &date_string) || | ||
| 72 | - !parse_year (&year, &date_string)) | ||
| 73 | + !parse_year (&year, &date_string) || | ||
| 74 | + !g_date_valid_dmy (day, month, year)) | ||
| 75 | return NULL; | ||
| 76 | |||
| 77 | /* There shouldn't be a timezone, but check anyway */ | ||
| 78 | @@ -285,7 +291,8 @@ parse_textual_date (const char *date_string) | ||
| 79 | if (!parse_day (&day, &date_string) || | ||
| 80 | !parse_month (&month, &date_string) || | ||
| 81 | !parse_year (&year, &date_string) || | ||
| 82 | - !parse_time (&hour, &minute, &second, &date_string)) | ||
| 83 | + !parse_time (&hour, &minute, &second, &date_string) || | ||
| 84 | + !g_date_valid_dmy (day, month, year)) | ||
| 85 | return NULL; | ||
| 86 | |||
| 87 | /* This time there *should* be a timezone, but we | ||
| 88 | diff --git a/tests/cookies-test.c b/tests/cookies-test.c | ||
| 89 | index 1c04534..6ba4458 100644 | ||
| 90 | --- a/tests/cookies-test.c | ||
| 91 | +++ b/tests/cookies-test.c | ||
| 92 | @@ -419,6 +419,15 @@ do_remove_feature_test (void) | ||
| 93 | g_uri_unref (uri); | ||
| 94 | } | ||
| 95 | |||
| 96 | +static void | ||
| 97 | +do_cookies_parsing_int32_overflow (void) | ||
| 98 | +{ | ||
| 99 | + SoupCookie *cookie = soup_cookie_parse ("Age=1;expires=3Mar9 999:9:9+ 999999999-age=main=gne=", NULL); | ||
| 100 | + g_assert_nonnull (cookie); | ||
| 101 | + g_assert_null (soup_cookie_get_expires (cookie)); | ||
| 102 | + soup_cookie_free (cookie); | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | int | ||
| 106 | main (int argc, char **argv) | ||
| 107 | { | ||
| 108 | @@ -440,6 +449,7 @@ main (int argc, char **argv) | ||
| 109 | g_test_add_func ("/cookies/accept-policy-subdomains", do_cookies_subdomain_policy_test); | ||
| 110 | g_test_add_func ("/cookies/parsing", do_cookies_parsing_test); | ||
| 111 | g_test_add_func ("/cookies/parsing/no-path-null-origin", do_cookies_parsing_nopath_nullorigin); | ||
| 112 | + g_test_add_func ("/cookies/parsing/int32-overflow", do_cookies_parsing_int32_overflow); | ||
| 113 | g_test_add_func ("/cookies/get-cookies/empty-host", do_get_cookies_empty_host_test); | ||
| 114 | g_test_add_func ("/cookies/remove-feature", do_remove_feature_test); | ||
| 115 | g_test_add_func ("/cookies/secure-cookies", do_cookies_strict_secure_test); | ||
| 116 | -- | ||
| 117 | 2.34.1 | ||
| 118 | |||
diff --git a/meta/recipes-support/libsoup/libsoup_3.0.7.bb b/meta/recipes-support/libsoup/libsoup_3.0.7.bb index 3ddcb3e568..af8554aa78 100644 --- a/meta/recipes-support/libsoup/libsoup_3.0.7.bb +++ b/meta/recipes-support/libsoup/libsoup_3.0.7.bb | |||
| @@ -44,6 +44,7 @@ SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \ | |||
| 44 | file://CVE-2025-32051-2.patch \ | 44 | file://CVE-2025-32051-2.patch \ |
| 45 | file://CVE-2025-46421.patch \ | 45 | file://CVE-2025-46421.patch \ |
| 46 | file://CVE-2025-4948.patch \ | 46 | file://CVE-2025-4948.patch \ |
| 47 | file://CVE-2025-4945.patch \ | ||
| 47 | " | 48 | " |
| 48 | SRC_URI[sha256sum] = "ebdf90cf3599c11acbb6818a9d9e3fc9d2c68e56eb829b93962972683e1bf7c8" | 49 | SRC_URI[sha256sum] = "ebdf90cf3599c11acbb6818a9d9e3fc9d2c68e56eb829b93962972683e1bf7c8" |
| 49 | 50 | ||
