All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] integrity: Do not load MOK and MOKx when secure boot be disabled
@ 2021-12-18  2:09 Lee, Chun-Yi
  2021-12-21 12:56 ` Mimi Zohar
  2021-12-21 23:28 ` Mimi Zohar
  0 siblings, 2 replies; 4+ messages in thread
From: Lee, Chun-Yi @ 2021-12-18  2:09 UTC (permalink / raw)
  To: Mimi Zohar, James Morris
  Cc: Eric Snowberg, David Howells, linux-security-module,
	linux-kernel, Lee, Chun-Yi

The security of Machine Owner Key (MOK) relies on secure boot. When
secure boot is disabled, EFI firmware will not verify binary code. Then
arbitrary efi binary code can modify MOK when rebooting.

This patch prevents MOK/MOKx be loaded when secure boot be disabled.

Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
---
 security/integrity/platform_certs/load_uefi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c
index f290f78c3f30..08b6d12f99b4 100644
--- a/security/integrity/platform_certs/load_uefi.c
+++ b/security/integrity/platform_certs/load_uefi.c
@@ -6,6 +6,7 @@
 #include <linux/err.h>
 #include <linux/efi.h>
 #include <linux/slab.h>
+#include <linux/ima.h>
 #include <keys/asymmetric-type.h>
 #include <keys/system_keyring.h>
 #include "../integrity.h"
@@ -176,6 +177,10 @@ static int __init load_uefi_certs(void)
 		kfree(dbx);
 	}
 
+	/* the MOK/MOKx can not be trusted when secure boot is disabled */
+	if (!arch_ima_get_secureboot())
+		return 0;
+
 	mokx = get_cert_list(L"MokListXRT", &mok_var, &mokxsize, &status);
 	if (!mokx) {
 		if (status == EFI_NOT_FOUND)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] integrity: Do not load MOK and MOKx when secure boot be disabled
  2021-12-18  2:09 [PATCH] integrity: Do not load MOK and MOKx when secure boot be disabled Lee, Chun-Yi
@ 2021-12-21 12:56 ` Mimi Zohar
  2021-12-21 23:28 ` Mimi Zohar
  1 sibling, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2021-12-21 12:56 UTC (permalink / raw)
  To: Lee, Chun-Yi, James Morris
  Cc: Eric Snowberg, David Howells, linux-security-module,
	linux-kernel, Lee, Chun-Yi, Petr Vorel

Hi Joey,

On Sat, 2021-12-18 at 10:09 +0800, Lee, Chun-Yi wrote:
> The security of Machine Owner Key (MOK) relies on secure boot. When
> secure boot is disabled, EFI firmware will not verify binary code. Then
> arbitrary efi binary code can modify MOK when rebooting.
> 
> This patch prevents MOK/MOKx be loaded when secure boot be disabled.
> 
> Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>

Sorry for the delay in testing this patch.  I got the booster Friday
and am still suffering from fever spikes, chills, and headaches. The
kexec selftest might need to be updated as well.

thanks,

Mimi

> ---
>  security/integrity/platform_certs/load_uefi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c
> index f290f78c3f30..08b6d12f99b4 100644
> --- a/security/integrity/platform_certs/load_uefi.c
> +++ b/security/integrity/platform_certs/load_uefi.c
> @@ -6,6 +6,7 @@
>  #include <linux/err.h>
>  #include <linux/efi.h>
>  #include <linux/slab.h>
> +#include <linux/ima.h>
>  #include <keys/asymmetric-type.h>
>  #include <keys/system_keyring.h>
>  #include "../integrity.h"
> @@ -176,6 +177,10 @@ static int __init load_uefi_certs(void)
>  		kfree(dbx);
>  	}
>  
> +	/* the MOK/MOKx can not be trusted when secure boot is disabled */
> +	if (!arch_ima_get_secureboot())
> +		return 0;
> +
>  	mokx = get_cert_list(L"MokListXRT", &mok_var, &mokxsize, &status);
>  	if (!mokx) {
>  		if (status == EFI_NOT_FOUND)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] integrity: Do not load MOK and MOKx when secure boot be disabled
  2021-12-18  2:09 [PATCH] integrity: Do not load MOK and MOKx when secure boot be disabled Lee, Chun-Yi
  2021-12-21 12:56 ` Mimi Zohar
@ 2021-12-21 23:28 ` Mimi Zohar
  2021-12-23  4:10   ` joeyli
  1 sibling, 1 reply; 4+ messages in thread
From: Mimi Zohar @ 2021-12-21 23:28 UTC (permalink / raw)
  To: Lee, Chun-Yi, James Morris
  Cc: Eric Snowberg, David Howells, linux-security-module,
	linux-kernel, Lee, Chun-Yi

On Sat, 2021-12-18 at 10:09 +0800, Lee, Chun-Yi wrote:
> The security of Machine Owner Key (MOK) relies on secure boot. When
> secure boot is disabled, EFI firmware will not verify binary code. Then
> arbitrary efi binary code can modify MOK when rebooting.
> 
> This patch prevents MOK/MOKx be loaded when secure boot be disabled.
> 
> Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>

Thanks, Joey!

This patch is now queued in the next-integrity-testing branch waiting
further review/tags.

Mimi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] integrity: Do not load MOK and MOKx when secure boot be disabled
  2021-12-21 23:28 ` Mimi Zohar
@ 2021-12-23  4:10   ` joeyli
  0 siblings, 0 replies; 4+ messages in thread
From: joeyli @ 2021-12-23  4:10 UTC (permalink / raw)
  To: Mimi Zohar
  Cc: Lee, Chun-Yi, James Morris, Eric Snowberg, David Howells,
	linux-security-module, linux-kernel

Hi Mimi,

On Tue, Dec 21, 2021 at 06:28:31PM -0500, Mimi Zohar wrote:
> On Sat, 2021-12-18 at 10:09 +0800, Lee, Chun-Yi wrote:
> > The security of Machine Owner Key (MOK) relies on secure boot. When
> > secure boot is disabled, EFI firmware will not verify binary code. Then
> > arbitrary efi binary code can modify MOK when rebooting.
> > 
> > This patch prevents MOK/MOKx be loaded when secure boot be disabled.
> > 
> > Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
> 
> Thanks, Joey!
> 
> This patch is now queued in the next-integrity-testing branch waiting
> further review/tags.
> 
> Mimi

Thanks for your review!
Joey Lee


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-23  4:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18  2:09 [PATCH] integrity: Do not load MOK and MOKx when secure boot be disabled Lee, Chun-Yi
2021-12-21 12:56 ` Mimi Zohar
2021-12-21 23:28 ` Mimi Zohar
2021-12-23  4:10   ` joeyli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.