diff options
| author | Rajeshkumar Ramasamy <rajeshkumar.ramasamy@windriver.com> | 2025-10-15 13:20:32 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-10-24 06:23:39 -0700 |
| commit | bf8139e03b13ad084617c3cf464bc307e64cd219 (patch) | |
| tree | da1b6a7cb7c43d963a31aec3110c4c1e9e0a2118 | |
| parent | f0bbacca4691aa76939e93e5028138095a23bf5c (diff) | |
| download | poky-bf8139e03b13ad084617c3cf464bc307e64cd219.tar.gz | |
glib-networking: fix CVE-2025-60018
glib-networking's OpenSSL backend fails to properly check the return
value of a call to BIO_write(), resulting in an out of bounds read.
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2025-60018
Upstream-patch:
https://gitlab.gnome.org/GNOME/glib-networking/-/commit/4dd540505d40babe488404f3174ec39f49a84485
(From OE-Core rev: e5ef6337416135d3c9d311c870ee72928aa75620)
Signed-off-by: Rajeshkumar Ramasamy <rajeshkumar.ramasamy@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-core/glib-networking/glib-networking/CVE-2025-60018.patch | 83 | ||||
| -rw-r--r-- | meta/recipes-core/glib-networking/glib-networking_2.78.1.bb | 1 |
2 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-networking/glib-networking/CVE-2025-60018.patch b/meta/recipes-core/glib-networking/glib-networking/CVE-2025-60018.patch new file mode 100644 index 0000000000..4ccf1cd43b --- /dev/null +++ b/meta/recipes-core/glib-networking/glib-networking/CVE-2025-60018.patch | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | From 4dd540505d40babe488404f3174ec39f49a84485 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michael Catanzaro <mcatanzaro@redhat.com> | ||
| 3 | Date: Mon, 4 Aug 2025 15:10:21 -0500 | ||
| 4 | Subject: [PATCH] openssl: properly check return value when writing to BIO | ||
| 5 | objects | ||
| 6 | |||
| 7 | In particular, we will read out of bounds, and then write the invalid | ||
| 8 | memory, if BIO_write() fails when getting the PROP_CERTIFICATE_PEM | ||
| 9 | property. Here we attempt to check the return value, but the check is | ||
| 10 | not correct. | ||
| 11 | |||
| 12 | This also fixes a leak of the BIO in the same place. | ||
| 13 | |||
| 14 | Also add error checking to PROP_SUBJECT_NAME and PROP_ISSUER_NAME, for | ||
| 15 | good measure. | ||
| 16 | |||
| 17 | Fixes #226 | ||
| 18 | |||
| 19 | CVE: CVE-2025-60018 | ||
| 20 | |||
| 21 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib-networking/-/commit/4dd540505d40babe488404f3174ec39f49a84485] | ||
| 22 | |||
| 23 | Signed-off-by: Rajeshkumar Ramasamy <rajeshkumar.ramasamy@windriver.com> | ||
| 24 | --- | ||
| 25 | tls/openssl/gtlscertificate-openssl.c | 25 +++++++++++++++---------- | ||
| 26 | 1 file changed, 15 insertions(+), 10 deletions(-) | ||
| 27 | |||
| 28 | diff --git a/tls/openssl/gtlscertificate-openssl.c b/tls/openssl/gtlscertificate-openssl.c | ||
| 29 | index 648f3e8..b536559 100644 | ||
| 30 | --- a/tls/openssl/gtlscertificate-openssl.c | ||
| 31 | +++ b/tls/openssl/gtlscertificate-openssl.c | ||
| 32 | @@ -362,15 +362,12 @@ g_tls_certificate_openssl_get_property (GObject *object, | ||
| 33 | case PROP_CERTIFICATE_PEM: | ||
| 34 | bio = BIO_new (BIO_s_mem ()); | ||
| 35 | |||
| 36 | - if (!PEM_write_bio_X509 (bio, openssl->cert) || !BIO_write (bio, "\0", 1)) | ||
| 37 | - certificate_pem = NULL; | ||
| 38 | - else | ||
| 39 | + if (PEM_write_bio_X509 (bio, openssl->cert) == 1 && BIO_write (bio, "\0", 1) == 1) | ||
| 40 | { | ||
| 41 | BIO_get_mem_data (bio, &certificate_pem); | ||
| 42 | g_value_set_string (value, certificate_pem); | ||
| 43 | - | ||
| 44 | - BIO_free_all (bio); | ||
| 45 | } | ||
| 46 | + BIO_free_all (bio); | ||
| 47 | break; | ||
| 48 | |||
| 49 | case PROP_PRIVATE_KEY: | ||
| 50 | @@ -411,8 +408,12 @@ g_tls_certificate_openssl_get_property (GObject *object, | ||
| 51 | case PROP_SUBJECT_NAME: | ||
| 52 | bio = BIO_new (BIO_s_mem ()); | ||
| 53 | name = X509_get_subject_name (openssl->cert); | ||
| 54 | - X509_NAME_print_ex (bio, name, 0, XN_FLAG_SEP_COMMA_PLUS); | ||
| 55 | - BIO_write (bio, "\0", 1); | ||
| 56 | + if (X509_NAME_print_ex (bio, name, 0, XN_FLAG_SEP_COMMA_PLUS) < 0 || | ||
| 57 | + BIO_write (bio, "\0", 1) != 1) | ||
| 58 | + { | ||
| 59 | + BIO_free_all (bio); | ||
| 60 | + break; | ||
| 61 | + } | ||
| 62 | BIO_get_mem_data (bio, (char **)&name_string); | ||
| 63 | g_value_set_string (value, name_string); | ||
| 64 | BIO_free_all (bio); | ||
| 65 | @@ -421,9 +422,13 @@ g_tls_certificate_openssl_get_property (GObject *object, | ||
| 66 | case PROP_ISSUER_NAME: | ||
| 67 | bio = BIO_new (BIO_s_mem ()); | ||
| 68 | name = X509_get_issuer_name (openssl->cert); | ||
| 69 | - X509_NAME_print_ex (bio, name, 0, XN_FLAG_SEP_COMMA_PLUS); | ||
| 70 | - BIO_write (bio, "\0", 1); | ||
| 71 | - BIO_get_mem_data (bio, &name_string); | ||
| 72 | + if (X509_NAME_print_ex (bio, name, 0, XN_FLAG_SEP_COMMA_PLUS) < 0 || | ||
| 73 | + BIO_write (bio, "\0", 1) != 1) | ||
| 74 | + { | ||
| 75 | + BIO_free_all (bio); | ||
| 76 | + break; | ||
| 77 | + } | ||
| 78 | + BIO_get_mem_data (bio, (char **)&name_string); | ||
| 79 | g_value_set_string (value, name_string); | ||
| 80 | BIO_free_all (bio); | ||
| 81 | break; | ||
| 82 | -- | ||
| 83 | 2.48.1 | ||
diff --git a/meta/recipes-core/glib-networking/glib-networking_2.78.1.bb b/meta/recipes-core/glib-networking/glib-networking_2.78.1.bb index 5060d9fd7a..22ca90724f 100644 --- a/meta/recipes-core/glib-networking/glib-networking_2.78.1.bb +++ b/meta/recipes-core/glib-networking/glib-networking_2.78.1.bb | |||
| @@ -31,6 +31,7 @@ inherit gnomebase gettext upstream-version-is-even gio-module-cache ptest-gnome | |||
| 31 | 31 | ||
| 32 | SRC_URI += "file://run-ptest" | 32 | SRC_URI += "file://run-ptest" |
| 33 | SRC_URI += "file://eagain.patch" | 33 | SRC_URI += "file://eagain.patch" |
| 34 | SRC_URI += "file://CVE-2025-60018.patch" | ||
| 34 | 35 | ||
| 35 | FILES:${PN} += "\ | 36 | FILES:${PN} += "\ |
| 36 | ${libdir}/gio/modules/libgio*.so \ | 37 | ${libdir}/gio/modules/libgio*.so \ |
