From: Jason Wang <jasowang@redhat.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Network Development <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net] net: validate untrusted gso packets
Date: Wed, 17 Jan 2018 19:54:02 +0800 [thread overview]
Message-ID: <39e93ed0-3e2c-20bd-ebb1-deeb37940175@redhat.com> (raw)
In-Reply-To: <CAF=yD-+LATRZ0X2+gQmDDLkgLnwgPZxvJMCu=zWqdLsOvwhcRw@mail.gmail.com>
On 2018年01月17日 12:33, Willem de Bruijn wrote:
> On Tue, Jan 16, 2018 at 11:04 PM, Jason Wang <jasowang@redhat.com> wrote:
>>
>> On 2018年01月17日 04:29, Willem de Bruijn wrote:
>>> From: Willem de Bruijn<willemb@google.com>
>>>
>>> Validate gso packet type and headers on kernel entry. Reuse the info
>>> gathered by skb_probe_transport_header.
>>>
>>> Syzbot found two bugs by passing bad gso packets in packet sockets.
>>> Untrusted user packets are limited to a small set of gso types in
>>> virtio_net_hdr_to_skb. But segmentation occurs on packet contents.
>>> Syzkaller was able to enter gso callbacks that are not hardened
>>> against untrusted user input.
>>
>> Do this mean there's something missed in exist header check for dodgy
>> packets?
> virtio_net_hdr_to_skb checks gso_type, but it does not verify that this
> type correctly describes the actual packet. Segmentation happens based
> on packet contents. So a packet was crafted to enter sctp gso, even
> though no such gso_type exists. This issue is not specific to sctp.
So it looks to me we should do it in here in sctp_gso_segment().
if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
/* Packet is from an untrusted source, reset gso_segs. */
And we probably need to recover what has been removed since
5c7cdf339af560f980b12eb6b0b5aa5f68ac6658 ("gso: Remove arbitrary checks
for unsupported GSO").
>
>>> User packets can also have corrupted headers, tripping up segmentation
>>> logic that expects sane packets from the trusted protocol stack.
>>> Hardening all segmentation paths against all bad packets is error
>>> prone and slows down the common path, so validate on kernel entry.
>>
>> I think evil packets should be rare in common case, so I'm not sure validate
>> it on kernel entry is a good choice especially consider we've already had
>> header check.
> This just makes that check more strict. Frequency of malicious packets is
> not really relevant if a single bad packet can cause damage.
We try hard to avoid flow dissector since its overhead is obvious. But
looks like this patch did it unconditionally, and even for non gso packet.
> The alternative to validate on kernel entry is to harden the entire segmentation
> layer and lower part of the stack. That is much harder to get right and not
> necessarily cheaper.
For performance reason. I think we should delay the check or
segmentation as much as possible until it was really needed.
>
> As a matter of fact, it incurs a cost on all packets, including the common
> case generated by the protocol stack.
Btw, this looks could be triggered from guest. So it looks at least a
DOS form guest to host which should be treated as CVE?
Thanks
next prev parent reply other threads:[~2018-01-17 11:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-16 20:29 [PATCH net] net: validate untrusted gso packets Willem de Bruijn
2018-01-17 4:04 ` Jason Wang
2018-01-17 4:33 ` Willem de Bruijn
2018-01-17 4:56 ` Willem de Bruijn
2018-01-17 11:58 ` Jason Wang
2018-01-17 11:54 ` Jason Wang [this message]
2018-01-17 14:27 ` Willem de Bruijn
2018-01-17 23:17 ` Willem de Bruijn
2018-01-18 3:35 ` Jason Wang
2018-01-18 5:09 ` Willem de Bruijn
2018-01-18 9:33 ` Jason Wang
2018-01-19 0:53 ` Willem de Bruijn
2018-01-19 8:19 ` Jason Wang
2018-01-19 14:39 ` Willem de Bruijn
2018-01-22 2:44 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39e93ed0-3e2c-20bd-ebb1-deeb37940175@redhat.com \
--to=jasowang@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).