oss-sec mailing list archives
Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[]
From: Mathias Krause <minipli () googlemail com>
Date: Mon, 25 Feb 2013 11:41:33 +0100
On Mon, Feb 25, 2013 at 11:13 AM, Solar Designer <solar () openwall com> wrote:
On Sun, Feb 24, 2013 at 10:10:45AM +0100, Mathias Krause wrote:An unprivileged user can send a netlink message resulting in an out-of-bounds access of the sock_diag_handlers[] array which, in turn, allows userland to take over control while in kernel mode. Patch (already in net/master): http://thread.gmane.org/gmane.linux.network/260061 Affected versions: v3.3 - v3.8Nice find! Do you happen to know of distro backports of the affected code to older kernels?
No. I haven't investigated this any further. So I don't know.
When you wrote that the bug is "in there for ages", did you mean that 3.3 has been out "for ages" or something else?
Kind of. The missing upper bound check was (and still is) in there in older kernels as well, at times as this code was still living in inet_diag.c. But it wasn't (and isn't) vulnerable as the inet_diag_handlers[] array is 256 elements big. So userland cannot exploit this as the type for the family is __u8.
PoC is not attached this time but can be requested on demand. Hint: Works well on Fedora 18, bypassing all mmap_min_addr checks. ;)SynQ posted a (different?) PoC here: https://rdot.org/forum/showthread.php?p=30828 Apparently, high values of mmap_min_addr (like 131072) happen to work against this one, but they might not work against other attack vectors or/and kernel builds. The bug is not a NULL+offset dereference, so mmap_min_addr was not supposed to help against its exploitation - it just happens to, sometimes.
Well, my Russian is actually non-existent but from reading the code, they should use other values to get much more reliable and, for that matter, higher addresses ;) In fact, on x86-64 one can generate addresses far, far away from mmap_min_addr. But sorry, I won't disclose any further details, to not get into legal issues. In Germany it's quite hairy to do things like that :/ But I can provide you my PoC in a private email -- for security evaluation. Mathias
Current thread:
- CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Mathias Krause (Feb 24)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Petr Matousek (Feb 24)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Solar Designer (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Mathias Krause (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Mathias Krause (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Solar Designer (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Mathias Krause (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Dan Rosenberg (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Mathias Krause (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Dan Rosenberg (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Mathias Krause (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Jason A. Donenfeld (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Dan Rosenberg (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Mathias Krause (Feb 25)
- Re: CVE Request: kernel - sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Solar Designer (Feb 25)