diff options
| author | Rajeshkumar Ramasamy <rajeshkumar.ramasamy@windriver.com> | 2025-10-17 10:05:54 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-10-24 06:23:40 -0700 |
| commit | 4456c586d178b4c0ac77ae18124e98c40e979c73 (patch) | |
| tree | 60d4339cdc08945e22d2fc843d20ec123bc63f68 | |
| parent | 6d7cfb5461db7d21572795a04c13cae7dc03a989 (diff) | |
| download | poky-4456c586d178b4c0ac77ae18124e98c40e979c73.tar.gz | |
glib-networking: fix CVE-2025-60019
glib-networking's OpenSSL backend fails to properly check the return
value of memory allocation routines. An out of memory condition could
potentially result in writing to an invalid memory location.
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2025-60019
Upstream-patch:
https://gitlab.gnome.org/GNOME/glib-networking/-/commit/70df675dd4f5e4a593b2f95406c1aac031aa8bc7
(From OE-Core rev: 8c44478c92a8b3d859c7fcecc734ac6bb399277e)
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-60019.patch | 147 | ||||
| -rw-r--r-- | meta/recipes-core/glib-networking/glib-networking_2.78.1.bb | 1 |
2 files changed, 148 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-networking/glib-networking/CVE-2025-60019.patch b/meta/recipes-core/glib-networking/glib-networking/CVE-2025-60019.patch new file mode 100644 index 0000000000..07d64bf2dc --- /dev/null +++ b/meta/recipes-core/glib-networking/glib-networking/CVE-2025-60019.patch | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | From 70df675dd4f5e4a593b2f95406c1aac031aa8bc7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michael Catanzaro <mcatanzaro@redhat.com> | ||
| 3 | Date: Thu, 21 Aug 2025 17:21:01 -0500 | ||
| 4 | Subject: [PATCH] openssl: check return values of BIO_new() | ||
| 5 | |||
| 6 | We probably need to check even more return values of even more OpenSSL | ||
| 7 | functions, but these ones allocate memory and that's particularly | ||
| 8 | important to get right. | ||
| 9 | |||
| 10 | CVE: CVE-2025-60019 | ||
| 11 | |||
| 12 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib-networking/-/commit/70df675dd4f5e4a593b2f95406c1aac031aa8bc7] | ||
| 13 | |||
| 14 | Signed-off-by: Rajeshkumar Ramasamy <rajeshkumar.ramasamy@windriver.com> | ||
| 15 | --- | ||
| 16 | tls/openssl/gtlscertificate-openssl.c | 42 ++++++++++++++++++++------- | ||
| 17 | 1 file changed, 32 insertions(+), 10 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/tls/openssl/gtlscertificate-openssl.c b/tls/openssl/gtlscertificate-openssl.c | ||
| 20 | index b536559..4fa5286 100644 | ||
| 21 | --- a/tls/openssl/gtlscertificate-openssl.c | ||
| 22 | +++ b/tls/openssl/gtlscertificate-openssl.c | ||
| 23 | @@ -166,6 +166,9 @@ export_privkey_to_der (GTlsCertificateOpenssl *openssl, | ||
| 24 | goto err; | ||
| 25 | |||
| 26 | bio = BIO_new (BIO_s_mem ()); | ||
| 27 | + if (!bio) | ||
| 28 | + goto err; | ||
| 29 | + | ||
| 30 | if (i2d_PKCS8_PRIV_KEY_INFO_bio (bio, pkcs8) == 0) | ||
| 31 | goto err; | ||
| 32 | |||
| 33 | @@ -199,6 +202,9 @@ export_privkey_to_pem (GTlsCertificateOpenssl *openssl) | ||
| 34 | return NULL; | ||
| 35 | |||
| 36 | bio = BIO_new (BIO_s_mem ()); | ||
| 37 | + if (!bio) | ||
| 38 | + goto out; | ||
| 39 | + | ||
| 40 | ret = PEM_write_bio_PKCS8PrivateKey (bio, openssl->key, NULL, NULL, 0, NULL, NULL); | ||
| 41 | if (ret == 0) | ||
| 42 | goto out; | ||
| 43 | @@ -211,7 +217,7 @@ export_privkey_to_pem (GTlsCertificateOpenssl *openssl) | ||
| 44 | result = g_strdup (data); | ||
| 45 | |||
| 46 | out: | ||
| 47 | - BIO_free_all (bio); | ||
| 48 | + g_clear_pointer (&bio, BIO_free_all); | ||
| 49 | return result; | ||
| 50 | } | ||
| 51 | |||
| 52 | @@ -232,6 +238,9 @@ maybe_import_pkcs12 (GTlsCertificateOpenssl *openssl) | ||
| 53 | return; | ||
| 54 | |||
| 55 | bio = BIO_new (BIO_s_mem ()); | ||
| 56 | + if (!bio) | ||
| 57 | + goto import_failed; | ||
| 58 | + | ||
| 59 | status = BIO_write (bio, openssl->pkcs12_data->data, openssl->pkcs12_data->len); | ||
| 60 | if (status <= 0) | ||
| 61 | goto import_failed; | ||
| 62 | @@ -323,7 +332,7 @@ g_tls_certificate_openssl_get_property (GObject *object, | ||
| 63 | guint8 *data; | ||
| 64 | BIO *bio; | ||
| 65 | GByteArray *byte_array; | ||
| 66 | - char *certificate_pem; | ||
| 67 | + const char *certificate_pem; | ||
| 68 | long size; | ||
| 69 | |||
| 70 | const ASN1_TIME *time_asn1; | ||
| 71 | @@ -362,12 +371,12 @@ g_tls_certificate_openssl_get_property (GObject *object, | ||
| 72 | case PROP_CERTIFICATE_PEM: | ||
| 73 | bio = BIO_new (BIO_s_mem ()); | ||
| 74 | |||
| 75 | - if (PEM_write_bio_X509 (bio, openssl->cert) == 1 && BIO_write (bio, "\0", 1) == 1) | ||
| 76 | + if (bio && PEM_write_bio_X509 (bio, openssl->cert) == 1 && BIO_write (bio, "\0", 1) == 1) | ||
| 77 | { | ||
| 78 | BIO_get_mem_data (bio, &certificate_pem); | ||
| 79 | g_value_set_string (value, certificate_pem); | ||
| 80 | } | ||
| 81 | - BIO_free_all (bio); | ||
| 82 | + g_clear_pointer (&bio, BIO_free_all); | ||
| 83 | break; | ||
| 84 | |||
| 85 | case PROP_PRIVATE_KEY: | ||
| 86 | @@ -407,6 +416,8 @@ g_tls_certificate_openssl_get_property (GObject *object, | ||
| 87 | |||
| 88 | case PROP_SUBJECT_NAME: | ||
| 89 | bio = BIO_new (BIO_s_mem ()); | ||
| 90 | + if (!bio) | ||
| 91 | + break; | ||
| 92 | name = X509_get_subject_name (openssl->cert); | ||
| 93 | if (X509_NAME_print_ex (bio, name, 0, XN_FLAG_SEP_COMMA_PLUS) < 0 || | ||
| 94 | BIO_write (bio, "\0", 1) != 1) | ||
| 95 | @@ -421,6 +432,8 @@ g_tls_certificate_openssl_get_property (GObject *object, | ||
| 96 | |||
| 97 | case PROP_ISSUER_NAME: | ||
| 98 | bio = BIO_new (BIO_s_mem ()); | ||
| 99 | + if (!bio) | ||
| 100 | + break; | ||
| 101 | name = X509_get_issuer_name (openssl->cert); | ||
| 102 | if (X509_NAME_print_ex (bio, name, 0, XN_FLAG_SEP_COMMA_PLUS) < 0 || | ||
| 103 | BIO_write (bio, "\0", 1) != 1) | ||
| 104 | @@ -533,8 +546,11 @@ g_tls_certificate_openssl_set_property (GObject *object, | ||
| 105 | break; | ||
| 106 | CRITICAL_IF_CERTIFICATE_INITIALIZED ("certificate-pem"); | ||
| 107 | bio = BIO_new_mem_buf ((gpointer)string, -1); | ||
| 108 | - openssl->cert = PEM_read_bio_X509 (bio, NULL, NULL, NULL); | ||
| 109 | - BIO_free (bio); | ||
| 110 | + if (bio) | ||
| 111 | + { | ||
| 112 | + openssl->cert = PEM_read_bio_X509 (bio, NULL, NULL, NULL); | ||
| 113 | + BIO_free (bio); | ||
| 114 | + } | ||
| 115 | if (openssl->cert) | ||
| 116 | openssl->have_cert = TRUE; | ||
| 117 | else if (!openssl->construct_error) | ||
| 118 | @@ -554,8 +570,11 @@ g_tls_certificate_openssl_set_property (GObject *object, | ||
| 119 | CRITICAL_IF_KEY_INITIALIZED ("private-key"); | ||
| 120 | |||
| 121 | bio = BIO_new_mem_buf (bytes->data, bytes->len); | ||
| 122 | - openssl->key = d2i_PrivateKey_bio (bio, NULL); | ||
| 123 | - BIO_free (bio); | ||
| 124 | + if (bio) | ||
| 125 | + { | ||
| 126 | + openssl->key = d2i_PrivateKey_bio (bio, NULL); | ||
| 127 | + BIO_free (bio); | ||
| 128 | + } | ||
| 129 | if (openssl->key) | ||
| 130 | openssl->have_key = TRUE; | ||
| 131 | else if (!openssl->construct_error) | ||
| 132 | @@ -575,8 +594,11 @@ g_tls_certificate_openssl_set_property (GObject *object, | ||
| 133 | CRITICAL_IF_KEY_INITIALIZED ("private-key-pem"); | ||
| 134 | |||
| 135 | bio = BIO_new_mem_buf ((gpointer)string, -1); | ||
| 136 | - openssl->key = PEM_read_bio_PrivateKey (bio, NULL, NULL, NULL); | ||
| 137 | - BIO_free (bio); | ||
| 138 | + if (bio) | ||
| 139 | + { | ||
| 140 | + openssl->key = PEM_read_bio_PrivateKey (bio, NULL, NULL, NULL); | ||
| 141 | + BIO_free (bio); | ||
| 142 | + } | ||
| 143 | if (openssl->key) | ||
| 144 | openssl->have_key = TRUE; | ||
| 145 | else if (!openssl->construct_error) | ||
| 146 | -- | ||
| 147 | 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 22ca90724f..ffbdf46162 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 | |||
| @@ -32,6 +32,7 @@ inherit gnomebase gettext upstream-version-is-even gio-module-cache ptest-gnome | |||
| 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 | SRC_URI += "file://CVE-2025-60018.patch" |
| 35 | SRC_URI += "file://CVE-2025-60019.patch" | ||
| 35 | 36 | ||
| 36 | FILES:${PN} += "\ | 37 | FILES:${PN} += "\ |
| 37 | ${libdir}/gio/modules/libgio*.so \ | 38 | ${libdir}/gio/modules/libgio*.so \ |
