Skip to contentSkip to conversation

net: flow_dissector: fail on evil iph->ihl

PATCH In review Jason Wang 6 participants 6 messages Nov 1, 2013 – Nov 3, 2013

Subsystems (2)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 net: flow_dissector: fail on evil iph->ihl

We don't validate iph->ihl which may lead a dead loop if we meet a IPIP skb whose iph->ihl is zero. Fix this by failing immediately when iph->ihl is evil (less than 5).

This issue were introduced by commit ec5efe7946280d1e84603389a1030ccec0a767ae (rps: support IPIP encapsulation).

Cc Eric Dumazet <[email protected]>
Cc Petr Matousek <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Daniel Borkmann <[email protected]>

---
This patch is needed for stable.

---
 net/core/flow_dissector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow_dissector.c +1 -1
index 8d7d0dd..143b6fd 100644
@@ -40,7 +40,7 @@ again:
 		struct iphdr _iph;
 ip:
 		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
-		if (!iph)
+		if (!iph || iph->ihl < 5)
 			return false;
 
 		if (ip_is_fragment(iph))
Signature · 1 line
1.8.1.2
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jason Wang

We don't validate iph->ihl which may lead a dead loop if we meet a IPIP skb whose iph->ihl is zero. Fix this by failing immediately when iph->ihl is evil (less than 5).

This issue were introduced by commit ec5efe7946280d1e84603389a1030ccec0a767ae (rps: support IPIP encapsulation).

Quoted 8 lines
Cc Eric Dumazet <[email protected]>
Cc Petr Matousek <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Daniel Borkmann <[email protected]>

---
This patch is needed for stable.
---

Thanks Jason !

#2 lore raw
In reply to Jason Wang
Quoted 6 lines · Jason Wang

We don't validate iph->ihl which may lead a dead loop if we meet a IPIP skb whose iph->ihl is zero. Fix this by failing immediately when iph->ihl is evil (less than 5).

This issue were introduced by commit ec5efe7946280d1e84603389a1030ccec0a767ae (rps: support IPIP encapsulation).

It would be helpful to include the CVE ID here:

CVE-2013-4348

Ben.

Quoted 24 lines
Cc Eric Dumazet <[email protected]>
Cc Petr Matousek <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Daniel Borkmann <[email protected]>

---
This patch is needed for stable.

---
 net/core/flow_dissector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow_dissector.c +1 -1
index 8d7d0dd..143b6fd 100644
@@ -40,7 +40,7 @@ again:
 		struct iphdr _iph;
 ip:
 		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
-		if (!iph)
+		if (!iph || iph->ihl < 5)
 			return false;
 
 		if (ip_is_fragment(iph))
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#3 lore raw
In reply to Jason Wang

From: Jason Wang <[email protected]>
Date: Fri, 1 Nov 2013 15:01:10 +0800

Quoted 4 lines

We don't validate iph->ihl which may lead a dead loop if we meet a IPIP skb whose iph->ihl is zero. Fix this by failing immediately when iph->ihl is evil (less than 5).

Quoted 8 lines

This issue were introduced by commit ec5efe7946280d1e84603389a1030ccec0a767ae (rps: support IPIP encapsulation).

Cc Eric Dumazet <[email protected]>
Cc Petr Matousek <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Daniel Borkmann <[email protected]>

Applied and queued up for -stable, thanks Jason.

Acked-by on v1 1/1
#4 lore raw
In reply to Jason Wang
Quoted 4 lines · Jason Wang

We don't validate iph->ihl which may lead a dead loop if we meet a IPIP skb whose iph->ihl is zero. Fix this by failing immediately when iph->ihl is evil (less than 5).

Quoted 8 lines

This issue were introduced by commit ec5efe7946280d1e84603389a1030ccec0a767ae (rps: support IPIP encapsulation).

Cc Eric Dumazet <[email protected]>
Cc Petr Matousek <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Daniel Borkmann <[email protected]>
Quoted 21 lines

---
This patch is needed for stable.

---
 net/core/flow_dissector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow_dissector.c +1 -1
index 8d7d0dd..143b6fd 100644
@@ -40,7 +40,7 @@ again:
 		struct iphdr _iph;
 ip:
 		iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
-		if (!iph)
+		if (!iph || iph->ihl < 5)
 			return false;
 
 		if (ip_is_fragment(iph))
Signature · 1 line
1.8.1.2
Acked-by on v1 1/1
#5 lore raw
In reply to Jason Wang
Quoted 4 lines · Jason Wang

We don't validate iph->ihl which may lead a dead loop if we meet a IPIP skb whose iph->ihl is zero. Fix this by failing immediately when iph->ihl is evil (less than 5).

Quoted 8 lines

This issue were introduced by commit ec5efe7946280d1e84603389a1030ccec0a767ae (rps: support IPIP encapsulation).

Cc Eric Dumazet <[email protected]>
Cc Petr Matousek <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Daniel Borkmann <[email protected]>

Sorry, a bit late as I was offline last 4 days, but fwiw: