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:	Mon, 21 Nov 2011 16:49:07 -0800
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Michael Halcrow <mhalcrow@...gle.com>
Cc:	tyhicks@...onical.com, ecryptfs@...r.kernel.org,
	linux-kernel@...r.kernel.org, thieule@...gle.com
Subject: Re: [PATCH] eCryptfs: Check array bounds for filename characters

On Mon, Nov 21, 2011 at 3:32 PM, Michael Halcrow <mhalcrow@...gle.com> wrote:
> Characters with ASCII values greater than the size of
> filename_rev_map[] are valid filename
> characters. ecryptfs_decode_from_filename() will access kernel memory
> beyond that array, and ecryptfs_parse_tag_70_packet() will then
> decrypt those characters.

Ugh. I really don't like the patch.

Why isn't the patch just this one-liner:

  diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
  index 58609bde3b9f..7c50715c05d6 100644
  --- a/fs/ecryptfs/crypto.c
  +++ b/fs/ecryptfs/crypto.c
  @@ -1943,7 +1943,7 @@ static unsigned char *portable_filename_chars
= ("-.0123456789ABCD"

   /* We could either offset on every reverse map or just pad some 0x00's
    * at the front here */
  -static const unsigned char filename_rev_map[] = {
  +static const unsigned char filename_rev_map[256] = {
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 7 */
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 15 */
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 23 */

instead?

Making invalid characters over \x50 be somehow magically different
from invalid characters elsewhere seems just totally bogus. There are
lots of characters that aren't valid, and they have the
filename_rev_map[] value of 0 elsewhere.

So the simpler one-liner is not only simpler, but gives much saner
semantics, I think - now invalid character '\x05' gets exactly the
same result as invalid character '\xf5'.

Hmm?

                         Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ