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:	Fri, 7 Dec 2012 21:30:25 -0500
From:	Neal Cardwell <ncardwell@...gle.com>
To:	David Miller <davem@...emloft.net>
Cc:	Eric Dumazet <edumazet@...gle.com>, Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net] inet_diag: fix oops for IPv4 AF_INET6 TCP SYN-RECV state

On Fri, Dec 7, 2012 at 1:20 PM, David Miller <davem@...emloft.net> wrote:
> From: Neal Cardwell <ncardwell@...gle.com>
> Date: Thu,  6 Dec 2012 10:42:26 -0500
>
>> Fix inet_diag to be aware of the fact that AF_INET6 TCP connections
>> instantiated for IPv4 traffic and in the SYN-RECV state were actually
>> created with inet_reqsk_alloc(), instead of inet6_reqsk_alloc(). This
>> means that for such connections inet6_rsk(req) returns a pointer to a
>> random spot in memory up to roughly 64KB beyond the end of the
>> request_sock.
>>
>> With this bug, for a server using AF_INET6 TCP sockets and serving
>> IPv4 traffic, an inet_diag user like `ss state SYN-RECV` would lead to
>> inet_diag_fill_req() causing an oops or the export to user space of 16
>> bytes of kernel memory as a garbage IPv6 address, depending on where
>> the garbage inet6_rsk(req) pointed.
>>
>> Signed-off-by: Neal Cardwell <ncardwell@...gle.com>
>
> Thanks for this fix, but it opens up more questions.
>
> We don't seem to make any validations upon inet_diag_hostcond's
> prefix_len.  That parameter we pass into bitstring_match() can
> be just about anything.
>
> As another example, what if we do an ipv6 128-bit compare on what's
> actually an ipv4 address in the inet request sock?
>
> I think we need to, using cond->family, make some kind of validations
> upon cond->prefix_len.

OK, sounds good. I will add a patch to fix the adjacent prefix_len
issues you mention.

It also seems like it considers IPv4 and IPv6 with the same prefix as
matching, which seems bogus; eg IMHO 128.0.0.0 should not match 1::/1.
 In general it seems to me that a mismatch between entry->family and
cond->family should prevent a match, except for the IPv4-mapped-IPv6
case it already handles.

Would you like these patches against net or net-next?

neal
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ