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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 18 Dec 2012 14:10:56 -0800
From:	Kees Cook <keescook@...omium.org>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Ming Lei <ming.lei@...onical.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v2] firmware: make sure paths remain relative

On Tue, Dec 18, 2012 at 2:02 PM, Alan Cox <alan@...rguk.ukuu.org.uk> wrote:
> On Tue, 18 Dec 2012 13:04:49 -0800
> Kees Cook <keescook@...omium.org> wrote:
>
>> Some devices have configurable firmware locations. If these configuration
>> mechanisms are exposed to unprivileged userspace, it may be possible to
>> load firmware from an unexpected location. To minimize the risk of this,
>> make sure the string "../" does not appear in the firmware name. This
>> means that neither the users of request_firmware, nor the uevent handler
>> have to do this filtering themselves.
>
> Have you verified no existing distribution ever does this ?

As far as I've found, the only non-static firmware loader I've found
is on Chrome OS.

>> +     if (strstr(name, "../")) {
>
> and this is obviously buggy and hasn't been tested
>
> Hint foo/bar../baz
>
> You need to check for ^../ /../ and /..$

The distros that handle the firmware uevent all prepend the string
"/lib/firmware/".

/lib/firmware/ + "../anything" will leave the directory.
/lib/firmware/ + "anything/../anything" can potentially leave the directory.
/lib/firmware/ + "anything/.." can potentially leave the directory,
but does not refer to a file.

Only "../" needs to be filtered. Given what a tiny corner-case this is
(non-root-control over the firmware filename path), I feel it is
sufficient.

The alternative is for the uevent handler to do this filtering, but it
seemed more sensible to have the kernel not feed it a crazy string in
the first place.

-Kees

--
Kees Cook
Chrome OS Security
--
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