diff options
| author | Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com> | 2022-03-01 18:00:42 +0530 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2022-03-27 08:18:20 -0700 |
| commit | 67ec3e049248f19c6fb50057ed91e4bc95b6a7fa (patch) | |
| tree | e3293b101a65bf4e053d831f1321b179322894d3 | |
| parent | 0722ff6f021df91542b5efa1ff5b5f6269f66add (diff) | |
| download | meta-openembedded-67ec3e049248f19c6fb50057ed91e4bc95b6a7fa.tar.gz | |
polkit: Fix for CVE-2021-4115
Add patch to fix CVE-2021-4115
Also, add a support patch to cleanly apply CVE patch
Link: https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/109
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
Signed-off-by: Ranjitsinh Rathod <ranjitsinhrathod1991@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
3 files changed, 121 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/polkit/files/0001-GHSL-2021-074-authentication-bypass-vulnerability-in.patch b/meta-oe/recipes-extended/polkit/files/0001-GHSL-2021-074-authentication-bypass-vulnerability-in.patch new file mode 100644 index 0000000000..2a2373ed5a --- /dev/null +++ b/meta-oe/recipes-extended/polkit/files/0001-GHSL-2021-074-authentication-bypass-vulnerability-in.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From a04d13affe0fa53ff618e07aa8f57f4c0e3b9b81 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jan Rybar <jrybar@redhat.com> | ||
| 3 | Date: Wed, 2 Jun 2021 15:43:38 +0200 | ||
| 4 | Subject: [PATCH] GHSL-2021-074: authentication bypass vulnerability in polkit | ||
| 5 | |||
| 6 | initial values returned if error caught | ||
| 7 | |||
| 8 | Upstream-Status: Backport [https://gitlab.freedesktop.org/polkit/polkit/-/commit/a04d13affe0fa53ff618e07aa8f57f4c0e3b9b81.patch] | ||
| 9 | CVE: CVE-2021-4115 | ||
| 10 | Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com> | ||
| 11 | |||
| 12 | --- | ||
| 13 | src/polkit/polkitsystembusname.c | 3 +++ | ||
| 14 | 1 file changed, 3 insertions(+) | ||
| 15 | |||
| 16 | diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c | ||
| 17 | index 8daa12c..8ed1363 100644 | ||
| 18 | --- a/src/polkit/polkitsystembusname.c | ||
| 19 | +++ b/src/polkit/polkitsystembusname.c | ||
| 20 | @@ -435,6 +435,9 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus | ||
| 21 | while (!((data.retrieved_uid && data.retrieved_pid) || data.caught_error)) | ||
| 22 | g_main_context_iteration (tmp_context, TRUE); | ||
| 23 | |||
| 24 | + if (data.caught_error) | ||
| 25 | + goto out; | ||
| 26 | + | ||
| 27 | if (out_uid) | ||
| 28 | *out_uid = data.uid; | ||
| 29 | if (out_pid) | ||
| 30 | -- | ||
| 31 | GitLab | ||
| 32 | |||
diff --git a/meta-oe/recipes-extended/polkit/files/CVE-2021-4115.patch b/meta-oe/recipes-extended/polkit/files/CVE-2021-4115.patch new file mode 100644 index 0000000000..37e0d6063c --- /dev/null +++ b/meta-oe/recipes-extended/polkit/files/CVE-2021-4115.patch | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | From 41cb093f554da8772362654a128a84dd8a5542a7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jan Rybar <jrybar@redhat.com> | ||
| 3 | Date: Mon, 21 Feb 2022 08:29:05 +0000 | ||
| 4 | Subject: [PATCH] CVE-2021-4115 (GHSL-2021-077) fix | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://gitlab.freedesktop.org/polkit/polkit/-/commit/41cb093f554da8772362654a128a84dd8a5542a7.patch] | ||
| 7 | CVE: CVE-2021-4115 | ||
| 8 | Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com> | ||
| 9 | |||
| 10 | --- | ||
| 11 | src/polkit/polkitsystembusname.c | 38 ++++++++++++++++++++++++++++---- | ||
| 12 | 1 file changed, 34 insertions(+), 4 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c | ||
| 15 | index 8ed1363..2fbf5f1 100644 | ||
| 16 | --- a/src/polkit/polkitsystembusname.c | ||
| 17 | +++ b/src/polkit/polkitsystembusname.c | ||
| 18 | @@ -62,6 +62,10 @@ enum | ||
| 19 | PROP_NAME, | ||
| 20 | }; | ||
| 21 | |||
| 22 | + | ||
| 23 | +guint8 dbus_call_respond_fails; // has to be global because of callback | ||
| 24 | + | ||
| 25 | + | ||
| 26 | static void subject_iface_init (PolkitSubjectIface *subject_iface); | ||
| 27 | |||
| 28 | G_DEFINE_TYPE_WITH_CODE (PolkitSystemBusName, polkit_system_bus_name, G_TYPE_OBJECT, | ||
| 29 | @@ -364,6 +368,7 @@ on_retrieved_unix_uid_pid (GObject *src, | ||
| 30 | if (!v) | ||
| 31 | { | ||
| 32 | data->caught_error = TRUE; | ||
| 33 | + dbus_call_respond_fails += 1; | ||
| 34 | } | ||
| 35 | else | ||
| 36 | { | ||
| 37 | @@ -405,6 +410,8 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus | ||
| 38 | tmp_context = g_main_context_new (); | ||
| 39 | g_main_context_push_thread_default (tmp_context); | ||
| 40 | |||
| 41 | + dbus_call_respond_fails = 0; | ||
| 42 | + | ||
| 43 | /* Do two async calls as it's basically as fast as one sync call. | ||
| 44 | */ | ||
| 45 | g_dbus_connection_call (connection, | ||
| 46 | @@ -432,11 +439,34 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus | ||
| 47 | on_retrieved_unix_uid_pid, | ||
| 48 | &data); | ||
| 49 | |||
| 50 | - while (!((data.retrieved_uid && data.retrieved_pid) || data.caught_error)) | ||
| 51 | - g_main_context_iteration (tmp_context, TRUE); | ||
| 52 | + while (TRUE) | ||
| 53 | + { | ||
| 54 | + /* If one dbus call returns error, we must wait until the other call | ||
| 55 | + * calls _call_finish(), otherwise fd leak is possible. | ||
| 56 | + * Resolves: GHSL-2021-077 | ||
| 57 | + */ | ||
| 58 | |||
| 59 | - if (data.caught_error) | ||
| 60 | - goto out; | ||
| 61 | + if ( (dbus_call_respond_fails > 1) ) | ||
| 62 | + { | ||
| 63 | + // we got two faults, we can leave | ||
| 64 | + goto out; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + if ((data.caught_error && (data.retrieved_pid || data.retrieved_uid))) | ||
| 68 | + { | ||
| 69 | + // we got one fault and the other call finally finished, we can leave | ||
| 70 | + goto out; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + if ( !(data.retrieved_uid && data.retrieved_pid) ) | ||
| 74 | + { | ||
| 75 | + g_main_context_iteration (tmp_context, TRUE); | ||
| 76 | + } | ||
| 77 | + else | ||
| 78 | + { | ||
| 79 | + break; | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | |||
| 83 | if (out_uid) | ||
| 84 | *out_uid = data.uid; | ||
| 85 | -- | ||
| 86 | GitLab | ||
| 87 | |||
diff --git a/meta-oe/recipes-extended/polkit/polkit_0.116.bb b/meta-oe/recipes-extended/polkit/polkit_0.116.bb index 77288b0082..aceb68699d 100644 --- a/meta-oe/recipes-extended/polkit/polkit_0.116.bb +++ b/meta-oe/recipes-extended/polkit/polkit_0.116.bb | |||
| @@ -26,6 +26,8 @@ SRC_URI = "http://www.freedesktop.org/software/polkit/releases/polkit-${PV}.tar. | |||
| 26 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ | 26 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ |
| 27 | file://0003-make-netgroup-support-optional.patch \ | 27 | file://0003-make-netgroup-support-optional.patch \ |
| 28 | file://CVE-2021-4034.patch \ | 28 | file://CVE-2021-4034.patch \ |
| 29 | file://0001-GHSL-2021-074-authentication-bypass-vulnerability-in.patch \ | ||
| 30 | file://CVE-2021-4115.patch \ | ||
| 29 | " | 31 | " |
| 30 | SRC_URI[md5sum] = "4b37258583393e83069a0e2e89c0162a" | 32 | SRC_URI[md5sum] = "4b37258583393e83069a0e2e89c0162a" |
| 31 | SRC_URI[sha256sum] = "88170c9e711e8db305a12fdb8234fac5706c61969b94e084d0f117d8ec5d34b1" | 33 | SRC_URI[sha256sum] = "88170c9e711e8db305a12fdb8234fac5706c61969b94e084d0f117d8ec5d34b1" |
