Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1439613 > unrolled thread
| Started by | Michal Kubecek <mkubecek@suse.cz> |
|---|---|
| First post | 2016-07-08 18:10 +0200 |
| Last post | 2016-07-11 21:50 +0200 |
| Articles | 7 — 6 participants |
Back to article view | Back to linux.kernel
[PATCH net] udp: prevent bugcheck if filter truncates packet too much Michal Kubecek <mkubecek@suse.cz> - 2016-07-08 18:10 +0200
Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much Eric Dumazet <eric.dumazet@gmail.com> - 2016-07-09 01:40 +0200
Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-07-09 02:30 +0200
Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much Daniel Borkmann <daniel@iogearbox.net> - 2016-07-09 11:50 +0200
Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much Michal Kubecek <mkubecek@suse.cz> - 2016-07-09 12:50 +0200
Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much Willem de Bruijn <willemb@google.com> - 2016-07-09 15:10 +0200
Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much David Miller <davem@davemloft.net> - 2016-07-11 21:50 +0200
| From | Michal Kubecek <mkubecek@suse.cz> |
|---|---|
| Date | 2016-07-08 18:10 +0200 |
| Subject | [PATCH net] udp: prevent bugcheck if filter truncates packet too much |
| Message-ID | <rSGvM-71i-11@gated-at.bofh.it> |
If socket filter truncates an udp packet below the length of UDP header
in udpv6_queue_rcv_skb() or udp_queue_rcv_skb(), it will trigger a
BUG_ON in skb_pull_rcsum(). This BUG_ON (and therefore a system crash if
kernel is configured that way) can be easily enforced by an unprivileged
user which was reported as CVE-2016-6162. For a reproducer, see
http://seclists.org/oss-sec/2016/q3/8
Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")
Reported-by: Marco Grassi <marco.gra@gmail.com>
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
net/ipv4/udp.c | 2 ++
net/ipv6/udp.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ca5e8ea29538..4aed8fc23d32 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1583,6 +1583,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (sk_filter(sk, skb))
goto drop;
+ if (unlikely(skb->len < sizeof(struct udphdr)))
+ goto drop;
udp_csum_pull_header(skb);
if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 005dc82c2138..acc09705618b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -620,6 +620,8 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (sk_filter(sk, skb))
goto drop;
+ if (unlikely(skb->len < sizeof(struct udphdr)))
+ goto drop;
udp_csum_pull_header(skb);
if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
--
2.9.0
[toc] | [next] | [standalone]
| From | Eric Dumazet <eric.dumazet@gmail.com> |
|---|---|
| Date | 2016-07-09 01:40 +0200 |
| Subject | Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much |
| Message-ID | <rSNxf-3dT-3@gated-at.bofh.it> |
| In reply to | #1439613 |
On Fri, 2016-07-08 at 17:52 +0200, Michal Kubecek wrote:
> If socket filter truncates an udp packet below the length of UDP header
> in udpv6_queue_rcv_skb() or udp_queue_rcv_skb(), it will trigger a
> BUG_ON in skb_pull_rcsum(). This BUG_ON (and therefore a system crash if
> kernel is configured that way) can be easily enforced by an unprivileged
> user which was reported as CVE-2016-6162. For a reproducer, see
> http://seclists.org/oss-sec/2016/q3/8
>
> Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")
> Reported-by: Marco Grassi <marco.gra@gmail.com>
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> ---
> net/ipv4/udp.c | 2 ++
> net/ipv6/udp.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index ca5e8ea29538..4aed8fc23d32 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1583,6 +1583,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
>
> if (sk_filter(sk, skb))
> goto drop;
> + if (unlikely(skb->len < sizeof(struct udphdr)))
> + goto drop;
>
> udp_csum_pull_header(skb);
> if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 005dc82c2138..acc09705618b 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -620,6 +620,8 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
>
> if (sk_filter(sk, skb))
> goto drop;
> + if (unlikely(skb->len < sizeof(struct udphdr)))
> + goto drop;
>
> udp_csum_pull_header(skb);
> if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
Arg :(
Acked-by: Eric Dumazet <edumazet@google.com>
Thanks !
[toc] | [prev] | [next] | [standalone]
| From | Alexei Starovoitov <alexei.starovoitov@gmail.com> |
|---|---|
| Date | 2016-07-09 02:30 +0200 |
| Subject | Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much |
| Message-ID | <rSOjE-3KG-15@gated-at.bofh.it> |
| In reply to | #1439849 |
On Sat, Jul 09, 2016 at 01:31:40AM +0200, Eric Dumazet wrote:
> On Fri, 2016-07-08 at 17:52 +0200, Michal Kubecek wrote:
> > If socket filter truncates an udp packet below the length of UDP header
> > in udpv6_queue_rcv_skb() or udp_queue_rcv_skb(), it will trigger a
> > BUG_ON in skb_pull_rcsum(). This BUG_ON (and therefore a system crash if
> > kernel is configured that way) can be easily enforced by an unprivileged
> > user which was reported as CVE-2016-6162. For a reproducer, see
> > http://seclists.org/oss-sec/2016/q3/8
> >
> > Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")
> > Reported-by: Marco Grassi <marco.gra@gmail.com>
> > Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> > ---
> > net/ipv4/udp.c | 2 ++
> > net/ipv6/udp.c | 2 ++
> > 2 files changed, 4 insertions(+)
> >
> > diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> > index ca5e8ea29538..4aed8fc23d32 100644
> > --- a/net/ipv4/udp.c
> > +++ b/net/ipv4/udp.c
> > @@ -1583,6 +1583,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> >
> > if (sk_filter(sk, skb))
> > goto drop;
> > + if (unlikely(skb->len < sizeof(struct udphdr)))
> > + goto drop;
> >
> > udp_csum_pull_header(skb);
> > if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
> > diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> > index 005dc82c2138..acc09705618b 100644
> > --- a/net/ipv6/udp.c
> > +++ b/net/ipv6/udp.c
> > @@ -620,6 +620,8 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> >
> > if (sk_filter(sk, skb))
> > goto drop;
> > + if (unlikely(skb->len < sizeof(struct udphdr)))
> > + goto drop;
> >
> > udp_csum_pull_header(skb);
> > if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
>
>
> Arg :(
>
> Acked-by: Eric Dumazet <edumazet@google.com>
this is incomplete fix. Please do not apply. See discussion at security@kernel
[toc] | [prev] | [next] | [standalone]
| From | Daniel Borkmann <daniel@iogearbox.net> |
|---|---|
| Date | 2016-07-09 11:50 +0200 |
| Subject | Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much |
| Message-ID | <rSX3z-1dn-15@gated-at.bofh.it> |
| In reply to | #1439858 |
On 07/09/2016 02:20 AM, Alexei Starovoitov wrote:
> On Sat, Jul 09, 2016 at 01:31:40AM +0200, Eric Dumazet wrote:
>> On Fri, 2016-07-08 at 17:52 +0200, Michal Kubecek wrote:
>>> If socket filter truncates an udp packet below the length of UDP header
>>> in udpv6_queue_rcv_skb() or udp_queue_rcv_skb(), it will trigger a
>>> BUG_ON in skb_pull_rcsum(). This BUG_ON (and therefore a system crash if
>>> kernel is configured that way) can be easily enforced by an unprivileged
>>> user which was reported as CVE-2016-6162. For a reproducer, see
>>> http://seclists.org/oss-sec/2016/q3/8
>>>
>>> Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")
>>> Reported-by: Marco Grassi <marco.gra@gmail.com>
>>> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
>>> ---
>>> net/ipv4/udp.c | 2 ++
>>> net/ipv6/udp.c | 2 ++
>>> 2 files changed, 4 insertions(+)
>>>
>>> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
>>> index ca5e8ea29538..4aed8fc23d32 100644
>>> --- a/net/ipv4/udp.c
>>> +++ b/net/ipv4/udp.c
>>> @@ -1583,6 +1583,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
>>>
>>> if (sk_filter(sk, skb))
>>> goto drop;
>>> + if (unlikely(skb->len < sizeof(struct udphdr)))
>>> + goto drop;
>>>
>>> udp_csum_pull_header(skb);
>>> if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
>>> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
>>> index 005dc82c2138..acc09705618b 100644
>>> --- a/net/ipv6/udp.c
>>> +++ b/net/ipv6/udp.c
>>> @@ -620,6 +620,8 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
>>>
>>> if (sk_filter(sk, skb))
>>> goto drop;
>>> + if (unlikely(skb->len < sizeof(struct udphdr)))
>>> + goto drop;
>>>
>>> udp_csum_pull_header(skb);
>>> if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
>>
>>
>> Arg :(
>>
>> Acked-by: Eric Dumazet <edumazet@google.com>
>
> this is incomplete fix. Please do not apply. See discussion at security@kernel
Ohh well, didn't see it earlier before starting the discussion at security@...
I'm okay if we take this for now as a quick band aid and find a better way how
to deal with the underlying issue long-term so that it's /guaranteed/ that it
doesn't bite us any further in such fragile ways.
[toc] | [prev] | [next] | [standalone]
| From | Michal Kubecek <mkubecek@suse.cz> |
|---|---|
| Date | 2016-07-09 12:50 +0200 |
| Subject | Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much |
| Message-ID | <rSXZD-1Oc-5@gated-at.bofh.it> |
| In reply to | #1439931 |
On Sat, Jul 09, 2016 at 11:48:49AM +0200, Daniel Borkmann wrote:
> On 07/09/2016 02:20 AM, Alexei Starovoitov wrote:
> >On Sat, Jul 09, 2016 at 01:31:40AM +0200, Eric Dumazet wrote:
> >>On Fri, 2016-07-08 at 17:52 +0200, Michal Kubecek wrote:
> >>>If socket filter truncates an udp packet below the length of UDP header
> >>>in udpv6_queue_rcv_skb() or udp_queue_rcv_skb(), it will trigger a
> >>>BUG_ON in skb_pull_rcsum(). This BUG_ON (and therefore a system crash if
> >>>kernel is configured that way) can be easily enforced by an unprivileged
> >>>user which was reported as CVE-2016-6162. For a reproducer, see
> >>>http://seclists.org/oss-sec/2016/q3/8
> >>>
> >>>Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")
> >>>Reported-by: Marco Grassi <marco.gra@gmail.com>
> >>>Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> >>>---
> >>> net/ipv4/udp.c | 2 ++
> >>> net/ipv6/udp.c | 2 ++
> >>> 2 files changed, 4 insertions(+)
> >>>
> >>>diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> >>>index ca5e8ea29538..4aed8fc23d32 100644
> >>>--- a/net/ipv4/udp.c
> >>>+++ b/net/ipv4/udp.c
> >>>@@ -1583,6 +1583,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> >>>
> >>> if (sk_filter(sk, skb))
> >>> goto drop;
> >>>+ if (unlikely(skb->len < sizeof(struct udphdr)))
> >>>+ goto drop;
> >>>
> >>> udp_csum_pull_header(skb);
> >>> if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
> >>>diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> >>>index 005dc82c2138..acc09705618b 100644
> >>>--- a/net/ipv6/udp.c
> >>>+++ b/net/ipv6/udp.c
> >>>@@ -620,6 +620,8 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> >>>
> >>> if (sk_filter(sk, skb))
> >>> goto drop;
> >>>+ if (unlikely(skb->len < sizeof(struct udphdr)))
> >>>+ goto drop;
> >>>
> >>> udp_csum_pull_header(skb);
> >>> if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
> >>
> >>
> >>Arg :(
> >>
> >>Acked-by: Eric Dumazet <edumazet@google.com>
> >
> >this is incomplete fix. Please do not apply. See discussion at security@kernel
>
> Ohh well, didn't see it earlier before starting the discussion at security@...
>
> I'm okay if we take this for now as a quick band aid and find a better
> way how to deal with the underlying issue long-term so that it's
> /guaranteed/ that it doesn't bite us any further in such fragile ways.
Agreed. As rc7 is due in a day or two, rushing a complex and intrusive
solution in might be too risky.
Michal Kubecek
[toc] | [prev] | [next] | [standalone]
| From | Willem de Bruijn <willemb@google.com> |
|---|---|
| Date | 2016-07-09 15:10 +0200 |
| Message-ID | <rT0b7-3r1-11@gated-at.bofh.it> |
| In reply to | #1439939 |
On Sat, Jul 9, 2016 at 6:43 AM, Michal Kubecek <mkubecek@suse.cz> wrote:
> On Sat, Jul 09, 2016 at 11:48:49AM +0200, Daniel Borkmann wrote:
>> On 07/09/2016 02:20 AM, Alexei Starovoitov wrote:
>> >On Sat, Jul 09, 2016 at 01:31:40AM +0200, Eric Dumazet wrote:
>> >>On Fri, 2016-07-08 at 17:52 +0200, Michal Kubecek wrote:
>> >>>If socket filter truncates an udp packet below the length of UDP header
>> >>>in udpv6_queue_rcv_skb() or udp_queue_rcv_skb(), it will trigger a
>> >>>BUG_ON in skb_pull_rcsum(). This BUG_ON (and therefore a system crash if
>> >>>kernel is configured that way) can be easily enforced by an unprivileged
>> >>>user which was reported as CVE-2016-6162. For a reproducer, see
>> >>>http://seclists.org/oss-sec/2016/q3/8
>> >>>
>> >>>Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")
>> >>>Reported-by: Marco Grassi <marco.gra@gmail.com>
>> >>>Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
>> >>>---
>
>> >>Acked-by: Eric Dumazet <edumazet@google.com>
>> >
>> >this is incomplete fix. Please do not apply. See discussion at security@kernel
>>
>> Ohh well, didn't see it earlier before starting the discussion at security@...
>>
>> I'm okay if we take this for now as a quick band aid and find a better
>> way how to deal with the underlying issue long-term so that it's
>> /guaranteed/ that it doesn't bite us any further in such fragile ways.
>
> Agreed. As rc7 is due in a day or two, rushing a complex and intrusive
> solution in might be too risky.
Acked-by: Willem de Bruijn <willemb@google.com>
Thanks, Michal.
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-07-11 21:50 +0200 |
| Subject | Re: [PATCH net] udp: prevent bugcheck if filter truncates packet too much |
| Message-ID | <rTPnk-30E-23@gated-at.bofh.it> |
| In reply to | #1439613 |
From: Michal Kubecek <mkubecek@suse.cz>
Date: Fri, 8 Jul 2016 17:52:33 +0200 (CEST)
> If socket filter truncates an udp packet below the length of UDP header
> in udpv6_queue_rcv_skb() or udp_queue_rcv_skb(), it will trigger a
> BUG_ON in skb_pull_rcsum(). This BUG_ON (and therefore a system crash if
> kernel is configured that way) can be easily enforced by an unprivileged
> user which was reported as CVE-2016-6162. For a reproducer, see
> http://seclists.org/oss-sec/2016/q3/8
>
> Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")
> Reported-by: Marco Grassi <marco.gra@gmail.com>
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Applied and queued up for -stable, thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web