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] [day] [month] [year] [list]
Message-ID: <48B17CF3.1040602@cs.helsinki.fi>
Date:	Sun, 24 Aug 2008 18:23:31 +0300
From:	Pekka Enberg <penberg@...helsinki.fi>
To:	Eric Sesterhenn <snakebyte@....de>
CC:	zippel@...ux-m68k.org, linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [Patch] Fix Buffer overflow in hfsplus with a corrupted image

Eric Sesterhenn wrote:
> * Pekka Enberg (penberg@...helsinki.fi) wrote:
>> Hi Eric,
>>
>> On Sun, Aug 24, 2008 at 4:07 PM, Eric Sesterhenn <snakebyte@....de> wrote:
>>> when an hfsplus image gets corrupted it might happen that the catalog
>>> namelength field gets b0rked. If we mount such an image
>>> the memcpy() in hfsplus_cat_build_key_uni() writes more than the 255
>>> that fit in the name field. Depending on the size of the overwritten
>>> data, we either only get memory corruption or also trigger an oops like
>>> this:
>>>
>>> --- linux/fs/hfsplus/catalog.c.orig     2008-08-24 14:52:03.000000000 +0200
>>> +++ linux/fs/hfsplus/catalog.c  2008-08-24 14:54:15.000000000 +0200
>>> @@ -168,6 +168,11 @@ int hfsplus_find_cat(struct super_block
>>>                return -EIO;
>>>        }
>>>
>>> +       if (be16_to_cpu(tmp.thread.nodeName.length) >= 127) {
>>> +               printk(KERN_ERR "hfs: catalog name length corrupted\n");
>>> +               return -EIO;
>>> +       }
>> So, where does this 127 come from? I can only find reference to a
>> maximum length of 255 unicode characters (16 bits per character) in
>> the following technical note for HFS+ (see sections "HFS Plus Names"
>> and "Catalog Thread Records"):
>>
>>   http://developer.apple.com/technotes/tn/tn1150.html
>>
>> Hmm?
> 
> Ah, i missed that the name array is __be16, i somehow assumed it was a
> char array, and tried to account for the multiplication by 2 in 
> hfsplus_cat_build_key_uni(). here is an updated fix.
> 
> Signed-off-by: Eric Sesterhenn <snakebyte@....de>
> 
> --- linux/fs/hfsplus/catalog.c.orig	2008-08-24 14:52:03.000000000 +0200
> +++ linux/fs/hfsplus/catalog.c	2008-08-24 14:54:15.000000000 +0200
> @@ -168,6 +168,11 @@ int hfsplus_find_cat(struct super_block 
>  		return -EIO;
>  	}
>  
> +	if (be16_to_cpu(tmp.thread.nodeName.length) > 255) {
> +		printk(KERN_ERR "hfs: catalog name length corrupted\n");
> +		return -EIO;
> +	}
> +
>  	hfsplus_cat_build_key_uni(fd->search_key, be32_to_cpu(tmp.thread.parentID),
>  				 &tmp.thread.nodeName);
>  	return hfs_brec_find(fd);

Looks good to me.

Reviewed-by: Pekka Enberg <penberg@...helsinki.fi>
--
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