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]
Date:   Thu, 14 Nov 2019 10:45:06 -0800
From:   Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
To:     Patrick Callaghan <patrickc@...ux.vnet.ibm.com>,
        Mimi Zohar <zohar@...ux.ibm.com>,
        Patrick Callaghan <patrickc@...ux.ibm.com>,
        linux-integrity@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, Sascha Hauer <s.hauer@...gutronix.de>
Subject: Re: [PATCH] ima: avoid appraise error for hash calc interrupt

On 11/14/19 5:55 AM, Patrick Callaghan wrote:

Hi Patrick,

> Hello Laks,
> You suggested that the if statement of the patch change to the
> following:
> 
> if ((rbuf_len == 0) || (offset + rbuf_len >= i_size)) {
> 
> Unless the file size changed between the time that i_size was set in
> ima_calc_file_hash_tfm() and an i_size_read() call was subsequently
> issued in a function downstream of the integrity_kernel_read() call,
> the rbuf_len returned on the integrity_kernel_read() call will not be
> more than i_size - offset. I do not think that it is possible for the
> file size to change during this window but nonetheless, if it can, this
> would be a different problem and I would not want to include this in my
> patch. That said, I do appreciate you taking time to review this patch.

You are right - unless the file size changes between the calls this 
problem would not occur. I agree - that issue, even if it can occur, 
should be addressed separately.

Another one (again - am not saying this needs to be addressed in this 
patch, but just wanted to point out)

	rbuf = kzalloc(PAGE_SIZE, GFP_KERNEL);
	...
	rbuf_len = integrity_kernel_read(file, offset, rbuf, PAGE_SIZE);
	...
	rc = crypto_shash_update(shash, rbuf, rbuf_len);

rbuf is of size PAGE_SIZE, but rbuf_len, returned by 
integrity_kernel_read() is passed as buffer size to 
crypto_shash_update() without any validation (rbuf_len <= PAGE_SIZE)

It is assumed here that integrity_kernel_read() would not return a 
length greater than rbuf size and hence crypto_shash_update() would 
never access beyond the given buffer.

thanks,
  -lakshmi


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ