Skip to contentSkip to conversation

glib-2.0: Backport fix for CVE-2024-52533

PATCH In review [email protected] 2 participants 4 messages Nov 14, 2024 – Nov 19, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 glib-2.0: Backport fix for CVE-2024-52533

From: Vijay Anusuri <[email protected]>

Upstream-Status: Backport from https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29

Reference: https://security-tracker.debian.org/tracker/CVE-2024-52533

---
 .../glib-2.0/glib-2.0/CVE-2024-52533.patch    | 49 +++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +49 -0
new file mode 100644
index 0000000000..3a06a9d782
@@ -0,0 +1,49 @@
+From ec0b708b981af77fef8e4bbb603cde4de4cd2e29 Mon Sep 17 00:00:00 2001
+From: Michael Catanzaro <[email protected]>
+Date: Thu, 19 Sep 2024 18:35:53 +0100
+Subject: [PATCH] gsocks4aproxy: Fix a single byte buffer overflow in connect
+ messages
+
+`SOCKS4_CONN_MSG_LEN` failed to account for the length of the final nul
+byte in the connect message, which is an addition in SOCKSv4a vs
+SOCKSv4.
+
+This means that the buffer for building and transmitting the connect
+message could be overflowed if the username and hostname are both
+`SOCKS4_MAX_LEN` (255) bytes long.
+
+Proxy configurations are normally statically configured, so the username
+is very unlikely to be near its maximum length, and hence this overflow
+is unlikely to be triggered in practice.
+
+(Commit message by Philip Withnall, diagnosis and fix by Michael
+Catanzaro.)
+
+Fixes: #3461
+
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29]
+CVE: CVE-2024-52533
+Signed-off-by: Vijay Anusuri <[email protected]>
+---
+ gio/gsocks4aproxy.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c
+index 3dad118eb7..b3146d08fd 100644
+--- a/gio/gsocks4aproxy.c
++++ b/gio/gsocks4aproxy.c
+@@ -79,9 +79,9 @@ g_socks4a_proxy_init (GSocks4aProxy *proxy)
+  * +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
+  * | VN | CD | DSTPORT |      DSTIP        | USERID       |NULL| HOST |    | NULL |
+  * +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
+- *    1    1      2              4           variable       1    variable
++ *    1    1      2              4           variable       1    variable    1
+  */
+-#define SOCKS4_CONN_MSG_LEN	    (9 + SOCKS4_MAX_LEN * 2)
++#define SOCKS4_CONN_MSG_LEN	    (10 + SOCKS4_MAX_LEN * 2)
+ static gint
+ set_connect_msg (guint8      *msg,
+ 		 const gchar *hostname,
+-- 
+GitLab
+
meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb +1 -0
index 35b51a3ec9..c628ac19af 100644
@@ -49,6 +49,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://CVE-2024-34397_16.patch \
            file://CVE-2024-34397_17.patch \
            file://CVE-2024-34397_18.patch \
+           file://CVE-2024-52533.patch \
            "
 SRC_URI:append:class-native = " file://relocate-modules.patch"
 
Signature · 1 line
2.25.1
#1 lore raw

Unfortunately I am getting ptest errors with this patch on both qemux86-64 and and qemuarm64:

AssertionError: Failed ptests:
{'glib-2.0': ['glib/gdatetime.test']}

https://valkyrie.yoctoproject.org/#/builders/73/builds/403
https://valkyrie.yoctoproject.org/#/builders/61/builds/403

Steve

Quoted 93 lines · Vijay Anusuri via lists.openembedded.org

From: Vijay Anusuri <[email protected]>

Upstream-Status: Backport from https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29

Reference: https://security-tracker.debian.org/tracker/CVE-2024-52533

---
 .../glib-2.0/glib-2.0/CVE-2024-52533.patch    | 49 +++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +49 -0
new file mode 100644
index 0000000000..3a06a9d782
@@ -0,0 +1,49 @@
+From ec0b708b981af77fef8e4bbb603cde4de4cd2e29 Mon Sep 17 00:00:00 2001
+From: Michael Catanzaro <[email protected]>
+Date: Thu, 19 Sep 2024 18:35:53 +0100
+Subject: [PATCH] gsocks4aproxy: Fix a single byte buffer overflow in connect
+ messages
+
+`SOCKS4_CONN_MSG_LEN` failed to account for the length of the final nul
+byte in the connect message, which is an addition in SOCKSv4a vs
+SOCKSv4.
+
+This means that the buffer for building and transmitting the connect
+message could be overflowed if the username and hostname are both
+`SOCKS4_MAX_LEN` (255) bytes long.
+
+Proxy configurations are normally statically configured, so the username
+is very unlikely to be near its maximum length, and hence this overflow
+is unlikely to be triggered in practice.
+
+(Commit message by Philip Withnall, diagnosis and fix by Michael
+Catanzaro.)
+
+Fixes: #3461
+
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29]
+CVE: CVE-2024-52533
+Signed-off-by: Vijay Anusuri <[email protected]>
+---
+ gio/gsocks4aproxy.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c
+index 3dad118eb7..b3146d08fd 100644
+--- a/gio/gsocks4aproxy.c
++++ b/gio/gsocks4aproxy.c
+@@ -79,9 +79,9 @@ g_socks4a_proxy_init (GSocks4aProxy *proxy)
+  * +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
+  * | VN | CD | DSTPORT |      DSTIP        | USERID       |NULL| HOST |    | NULL |
+  * +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
+- *    1    1      2              4           variable       1    variable
++ *    1    1      2              4           variable       1    variable    1
+  */
+-#define SOCKS4_CONN_MSG_LEN       (9 + SOCKS4_MAX_LEN * 2)
++#define SOCKS4_CONN_MSG_LEN       (10 + SOCKS4_MAX_LEN * 2)
+ static gint
+ set_connect_msg (guint8      *msg,
+                const gchar *hostname,
+--
+GitLab
+
meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb +1 -1
index 35b51a3ec9..c628ac19af 100644
@@ -49,6 +49,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://CVE-2024-34397_16.patch \
            file://CVE-2024-34397_17.patch \
            file://CVE-2024-34397_18.patch \
+           file://CVE-2024-52533.patch \
            "
 SRC_URI:append:class-native = " file://relocate-modules.patch"
 
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#207156): https://lists.openembedded.org/g/openembedded-core/message/207156
Mute This Topic: https://lists.openembedded.org/mt/109572074/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Steve,

It looks like tzdata update to 2024b causing the ptest failures for glib2.0 in the file "glib/gdatetime.test" not with CVE -2024-52533.

Below commit is missing in the kirkstone-nut

https://git.openembedded.org/openembedded-core/commit/?id=0c8f87d5d4ec9f286b1e85d114cb9a728c1ff64b

I think we need to pull/merge the above commit along with the tzdata update to 2024b.
https://git.openembedded.org/openembedded-core-contrib/commit/?h=stable/kirkstone-nut&id=723c32ff858ccfd5a69e63e681a57903af928fd5

Reference: https://lists.openembedded.org/g/openembedded-core/message/206095

Thanks & Regards,
Vijay

Quoted 123 lines · Steve Sakoman

Unfortunately I am getting ptest errors with this patch on both qemux86-64 and and qemuarm64:

AssertionError: Failed ptests:
{'glib-2.0': ['glib/gdatetime.test']}

https://valkyrie.yoctoproject.org/#/builders/73/builds/403
https://valkyrie.yoctoproject.org/#/builders/61/builds/403

Steve

Quoted 4 lines · Vijay Anusuri via lists.openembedded.org

From: Vijay Anusuri <[email protected]>

Upstream-Status: Backport from

https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29

Quoted 9 lines

Reference: https://security-tracker.debian.org/tracker/CVE-2024-52533

---
 .../glib-2.0/glib-2.0/CVE-2024-52533.patch    | 49 +++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644

meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch

meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch line 4

Quoted 9 lines

new file mode 100644
index 0000000000..3a06a9d782

meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +4 -0
@@ -0,0 +1,49 @@
+From ec0b708b981af77fef8e4bbb603cde4de4cd2e29 Mon Sep 17 00:00:00 2001
+From: Michael Catanzaro <[email protected]>
+Date: Thu, 19 Sep 2024 18:35:53 +0100
+Subject: [PATCH] gsocks4aproxy: Fix a single byte buffer overflow in

connect

Quoted 10 lines
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +10 -0
+ messages
+
+`SOCKS4_CONN_MSG_LEN` failed to account for the length of the final nul
+byte in the connect message, which is an addition in SOCKSv4a vs
+SOCKSv4.
+
+This means that the buffer for building and transmitting the connect
+message could be overflowed if the username and hostname are both
+`SOCKS4_MAX_LEN` (255) bytes long.
+

meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch

Quoted 10 lines
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +10 -0
+Proxy configurations are normally statically configured, so the username
+is very unlikely to be near its maximum length, and hence this overflow
+is unlikely to be triggered in practice.
+
+(Commit message by Philip Withnall, diagnosis and fix by Michael
+Catanzaro.)
+
+Fixes: #3461
+
+Upstream-Status: Backport [

https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29
]

meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch

Quoted 12 lines
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +12 -0
+CVE: CVE-2024-52533
+Signed-off-by: Vijay Anusuri <[email protected]>
+---
+ gio/gsocks4aproxy.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c
+index 3dad118eb7..b3146d08fd 100644
+--- a/gio/gsocks4aproxy.c
++++ b/gio/gsocks4aproxy.c
+@@ -79,9 +79,9 @@ g_socks4a_proxy_init (GSocks4aProxy *proxy)
+  *
+----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
> +  * | VN | CD | DSTPORT |      DSTIP        | USERID       |NULL| HOST
|    | NULL |
> +  *
+----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
> +- *    1    1      2              4           variable       1

variable

meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch line 37

Quoted 1 line
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +1 -0
++ *    1    1      2              4           variable       1

variable 1

Review

Quoted 10 lines
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +9 -0
+  */
+-#define SOCKS4_CONN_MSG_LEN       (9 + SOCKS4_MAX_LEN * 2)
++#define SOCKS4_CONN_MSG_LEN       (10 + SOCKS4_MAX_LEN * 2)
+ static gint
+ set_connect_msg (guint8      *msg,
+                const gchar *hostname,
+--
+GitLab
+
(quoted diff) +0 -0

b/meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb

meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb SRC_URI =

Quoted 4 lines

index 35b51a3ec9..c628ac19af 100644

meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb +0 -0
@@ -49,6 +49,7 @@ SRC_URI =

"${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \

Quoted 11 lines
meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb +1 -1
            file://CVE-2024-34397_16.patch \
            file://CVE-2024-34397_17.patch \
            file://CVE-2024-34397_18.patch \
+           file://CVE-2024-52533.patch \
            "
 SRC_URI:append:class-native = " file://relocate-modules.patch"
 
--

2.25.1

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#207156):

https://lists.openembedded.org/g/openembedded-core/message/207156

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/109572074/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Hi Vijay,

Thanks for investigating this. I'll take care of adding the missing changes.

Steve

Quoted 126 lines · Vijay Anusuri

Hi Steve,

It looks like tzdata update to 2024b causing the ptest failures for glib2.0 in the file "glib/gdatetime.test" not with CVE -2024-52533.

Below commit is missing in the kirkstone-nut

https://git.openembedded.org/openembedded-core/commit/?id=0c8f87d5d4ec9f286b1e85d114cb9a728c1ff64b

I think we need to pull/merge the above commit along with the tzdata update to 2024b.
https://git.openembedded.org/openembedded-core-contrib/commit/?h=stable/kirkstone-nut&id=723c32ff858ccfd5a69e63e681a57903af928fd5

Reference: https://lists.openembedded.org/g/openembedded-core/message/206095

Thanks & Regards,
Vijay

Quoted 108 lines · Steve Sakoman

Unfortunately I am getting ptest errors with this patch on both qemux86-64 and and qemuarm64:

AssertionError: Failed ptests:
{'glib-2.0': ['glib/gdatetime.test']}

https://valkyrie.yoctoproject.org/#/builders/73/builds/403
https://valkyrie.yoctoproject.org/#/builders/61/builds/403

Steve

Quoted 93 lines · Vijay Anusuri via lists.openembedded.org

From: Vijay Anusuri <[email protected]>

Upstream-Status: Backport from https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29

Reference: https://security-tracker.debian.org/tracker/CVE-2024-52533

---
 .../glib-2.0/glib-2.0/CVE-2024-52533.patch    | 49 +++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch
meta/recipes-core/glib-2.0/glib-2.0/CVE-2024-52533.patch new file +49 -0
new file mode 100644
index 0000000000..3a06a9d782
@@ -0,0 +1,49 @@
+From ec0b708b981af77fef8e4bbb603cde4de4cd2e29 Mon Sep 17 00:00:00 2001
+From: Michael Catanzaro <[email protected]>
+Date: Thu, 19 Sep 2024 18:35:53 +0100
+Subject: [PATCH] gsocks4aproxy: Fix a single byte buffer overflow in connect
+ messages
+
+`SOCKS4_CONN_MSG_LEN` failed to account for the length of the final nul
+byte in the connect message, which is an addition in SOCKSv4a vs
+SOCKSv4.
+
+This means that the buffer for building and transmitting the connect
+message could be overflowed if the username and hostname are both
+`SOCKS4_MAX_LEN` (255) bytes long.
+
+Proxy configurations are normally statically configured, so the username
+is very unlikely to be near its maximum length, and hence this overflow
+is unlikely to be triggered in practice.
+
+(Commit message by Philip Withnall, diagnosis and fix by Michael
+Catanzaro.)
+
+Fixes: #3461
+
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/ec0b708b981af77fef8e4bbb603cde4de4cd2e29]
+CVE: CVE-2024-52533
+Signed-off-by: Vijay Anusuri <[email protected]>
+---
+ gio/gsocks4aproxy.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c
+index 3dad118eb7..b3146d08fd 100644
+--- a/gio/gsocks4aproxy.c
++++ b/gio/gsocks4aproxy.c
+@@ -79,9 +79,9 @@ g_socks4a_proxy_init (GSocks4aProxy *proxy)
+  * +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
+  * | VN | CD | DSTPORT |      DSTIP        | USERID       |NULL| HOST |    | NULL |
+  * +----+----+----+----+----+----+----+----+----+----+....+----+------+....+------+
+- *    1    1      2              4           variable       1    variable
++ *    1    1      2              4           variable       1    variable    1
+  */
+-#define SOCKS4_CONN_MSG_LEN       (9 + SOCKS4_MAX_LEN * 2)
++#define SOCKS4_CONN_MSG_LEN       (10 + SOCKS4_MAX_LEN * 2)
+ static gint
+ set_connect_msg (guint8      *msg,
+                const gchar *hostname,
+--
+GitLab
+
meta/recipes-core/glib-2.0/glib-2.0_2.72.3.bb +1 -1
index 35b51a3ec9..c628ac19af 100644
@@ -49,6 +49,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://CVE-2024-34397_16.patch \
            file://CVE-2024-34397_17.patch \
            file://CVE-2024-34397_18.patch \
+           file://CVE-2024-52533.patch \
            "
 SRC_URI:append:class-native = " file://relocate-modules.patch"
 
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#207156): https://lists.openembedded.org/g/openembedded-core/message/207156
Mute This Topic: https://lists.openembedded.org/mt/109572074/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-