lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <F47EA986-6D9D-423A-B80E-2A54DB2214D5@oracle.com>
Date:   Tue, 19 Jul 2022 17:38:35 +0000
From:   John Haxby <john.haxby@...cle.com>
To:     Eric Snowberg <eric.snowberg@...cle.com>
CC:     "linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>,
        "zohar@...ux.ibm.com" <zohar@...ux.ibm.com>,
        "dmitry.kasatkin@...il.com" <dmitry.kasatkin@...il.com>,
        "jmorris@...ei.org" <jmorris@...ei.org>,
        "serge@...lyn.com" <serge@...lyn.com>,
        "matthewgarrett@...gle.com" <matthewgarrett@...gle.com>,
        "linux-security-module@...r.kernel.org" 
        <linux-security-module@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH] lockdown: Fix kexec lockdown bypass with ima policy



> On 19 Jul 2022, at 18:16, Eric Snowberg <eric.snowberg@...cle.com> wrote:
> 
> The lockdown LSM is primarily used in conjunction with UEFI Secure Boot.
> This LSM may also be used on machines without UEFI.  It can also be enabled
> when UEFI Secure Boot is disabled. One of lockdown's features is to prevent
> kexec from loading untrusted kernels. Lockdown can be enabled through a
> bootparam or after the kernel has booted through securityfs.
> 
> If IMA appraisal is used with the "ima_appraise=log" boot param,
> lockdown can be defeated with kexec on any machine when Secure Boot is
> disabled or unavailable. IMA prevents setting "ima_appraise=log"
> from the boot param when Secure Boot is enabled, but this does not cover
> cases where lockdown is used without Secure Boot.
> 
> To defeat lockdown, boot without Secure Boot and add ima_appraise=log
> to the kernel command line; then:
> 
> $ echo "integrity" > /sys/kernel/security/lockdown
> $ echo "appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig" > \
>  /sys/kernel/security/ima/policy
> $ kexec -ls unsigned-kernel
> 
> Add a call to verify ima appraisal is set to "enforce" whenever lockdown
> is enabled. This fixes CVE-2022-21505.
> 
> Fixes: 29d3c1c8dfe7 ("kexec: Allow kexec_file() with appropriate IMA policy when locked down")
> Signed-off-by: Eric Snowberg <eric.snowberg@...cle.com>
> Acked-by: Mimi Zohar <zohar@...ux.ibm.com>


Reviewed-by: John Haxby <john.haxby@...cle.com>


> ---
> security/integrity/ima/ima_policy.c | 4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 73917413365b..a8802b8da946 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -2247,6 +2247,10 @@ bool ima_appraise_signature(enum kernel_read_file_id id)
> 	if (id >= READING_MAX_ID)
> 		return false;
> 
> +	if (id == READING_KEXEC_IMAGE && !(ima_appraise & IMA_APPRAISE_ENFORCE)
> +	    && security_locked_down(LOCKDOWN_KEXEC))
> +		return false;
> +
> 	func = read_idmap[id] ?: FILE_CHECK;
> 
> 	rcu_read_lock();
> --
> 2.27.0
> 
> 


Download attachment "signature.asc" of type "application/pgp-signature" (269 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ