udp: prevent bugcheck if filter truncates packet too much
Subsystems (3)
PATCH 1/1 udp: prevent bugcheck if filter truncates packet too much
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
--- net/ipv4/udp.c | 2 ++ net/ipv6/udp.c | 2 ++ 2 files changed, 4 insertions(+)
net/ipv4/udp.c +2 -0
@@ -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)) {
net/ipv6/udp.c +2 -0
@@ -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)) {
Signature · 1 line
2.9.0
Quoted 33 lines · Michal Kubecek
If socket filter truncates an udp packet below the length of UDP header in
udpv6_queue_rcv_skb()orudp_queue_rcv_skb(), it will trigger aBUG_ONinskb_pull_rcsum(). ThisBUG_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/8Fixes e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")Reported-by Marco Grassi <[email protected]>Signed-off-by Michal Kubecek <[email protected]>--- net/ipv4/udp.c | 2 ++ net/ipv6/udp.c | 2 ++ 2 files changed, 4 insertions(+)net/ipv4/udp.c +2
-0@@ -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)) {net/ipv6/udp.c +0
-0
net/ipv6/udp.c int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · line 627
Quoted 8 lines
net/ipv6/udp.c +2
-0@@ -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 :(
Thanks !
Quoted 40 lines · Eric Dumazet
Quoted 39 lines · Michal Kubecek
If socket filter truncates an udp packet below the length of UDP header in
udpv6_queue_rcv_skb()orudp_queue_rcv_skb(), it will trigger aBUG_ONinskb_pull_rcsum(). ThisBUG_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/8Fixes e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")Reported-by Marco Grassi <[email protected]>Signed-off-by Michal Kubecek <[email protected]>--- net/ipv4/udp.c | 2 ++ net/ipv6/udp.c | 2 ++ 2 files changed, 4 insertions(+)net/ipv4/udp.c +2
-0@@ -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)) {net/ipv6/udp.c +2
-0@@ -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;
Quoted 7 lines
net/ipv6/udp.c int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · line 627
Quoted 2 lines
net/ipv6/udp.c +0
-0udp_csum_pull_header (skb);if (sk_rcvqueues_full (sk, sk->sk_rcvbuf)) {Arg :(
Acked-by Eric Dumazet <[email protected]>
this is incomplete fix. Please do not apply. See discussion at security@kernel
Quoted 47 lines · Alexei Starovoitov
Quoted 46 lines · Eric Dumazet
Quoted 33 lines · Michal Kubecek
If socket filter truncates an udp packet below the length of UDP header in
udpv6_queue_rcv_skb()orudp_queue_rcv_skb(), it will trigger aBUG_ONinskb_pull_rcsum(). ThisBUG_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/8Fixes e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")Reported-by Marco Grassi <[email protected]>Signed-off-by Michal Kubecek <[email protected]>--- net/ipv4/udp.c | 2 ++ net/ipv6/udp.c | 2 ++ 2 files changed, 4 insertions(+)net/ipv4/udp.c +2
-0@@ -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)) {net/ipv6/udp.c +0
-0net/ipv6/udp.c int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · line 627
Quoted 8 lines
net/ipv6/udp.c +2
-0@@ -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 :(
Quoted 3 lines
Quoted 1 line
Acked-by Eric Dumazet <[email protected]>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.
Quoted 50 lines · Daniel Borkmann
Quoted 49 lines · Alexei Starovoitov
Quoted 47 lines · Eric Dumazet
Quoted 33 lines · Michal Kubecek
If socket filter truncates an udp packet below the length of UDP header in
udpv6_queue_rcv_skb()orudp_queue_rcv_skb(), it will trigger aBUG_ONinskb_pull_rcsum(). ThisBUG_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/8Fixes e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")Reported-by Marco Grassi <[email protected]>Signed-off-by Michal Kubecek <[email protected]>--- net/ipv4/udp.c | 2 ++ net/ipv6/udp.c | 2 ++ 2 files changed, 4 insertions(+)net/ipv4/udp.c +2
-0@@ -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)) {net/ipv6/udp.c +0
-0net/ipv6/udp.c int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · line 627
Quoted 8 lines
net/ipv6/udp.c +2
-0@@ -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 <[email protected]>
Quoted 7 lines
Quoted 1 line
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
Willem de Bruijn
Acked-byQuoted 20 lines · Michal Kubecek
Quoted 19 lines · Daniel Borkmann
Quoted 17 lines · Alexei Starovoitov
Quoted 8 lines · Eric Dumazet
Quoted 7 lines · Michal Kubecek
If socket filter truncates an udp packet below the length of UDP header in
udpv6_queue_rcv_skb()orudp_queue_rcv_skb(), it will trigger aBUG_ONinskb_pull_rcsum(). ThisBUG_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/8Quoted 6 lines
Quoted 4 lines
Fixes e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")Reported-by Marco Grassi <[email protected]>Signed-off-by Michal Kubecek <[email protected]>---
Acked-by Eric Dumazet <[email protected]>this is incomplete fix. Please do not apply. See discussion at security@kernel
Quoted 8 lines
Quoted 5 lines
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.
Thanks, Michal.
David Miller
maintainerFrom: Michal Kubecek <[email protected]>
Date: Fri, 8 Jul 2016 17:52:33 +0200 (CEST)
Quoted 10 lines
If socket filter truncates an udp packet below the length of UDP header in
udpv6_queue_rcv_skb()orudp_queue_rcv_skb(), it will trigger aBUG_ONinskb_pull_rcsum(). ThisBUG_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/8Fixes e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")Reported-by Marco Grassi <[email protected]>Signed-off-by Michal Kubecek <[email protected]>
Applied and queued up for -stable, thanks.