Skip to contentSkip to conversation

ipv6/exthdrs: accept tlv which includes only padding

PATCH In review Jiri Pirko 5 participants 9 messages Sep 6, 2013 – Sep 11, 2013

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 ipv6/exthdrs: accept tlv which includes only padding

In rfc4942 and rfc2460 I cannot find anything which would implicate to drop packets which have only padding in tlv.

Current behaviour breaks TAHI Test v6LC.1.2.6.

Problem was intruduced in:
9b905fe6843 "ipv6/exthdrs: strict Pad1 and PadN check"

---
 net/ipv6/exthdrs.c | 6 ------
 1 file changed, 6 deletions(-)
net/ipv6/exthdrs.c +0 -6
index 07a7d65..8d67900 100644
@@ -162,12 +162,6 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, struct sk_buff *skb)
 		off += optlen;
 		len -= optlen;
 	}
-	/* This case will not be caught by above check since its padding
-	 * length is smaller than 7:
-	 * 1 byte NH + 1 byte Length + 6 bytes Padding
-	 */
-	if ((padlen == 6) && ((off - skb_network_header_len(skb)) == 8))
-		goto bad;
 
 	if (len == 0)
 		return true;
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Jiri,

Quoted 2 lines · Jiri Pirko

In rfc4942 and rfc2460 I cannot find anything which would implicate to drop packets which have only padding in tlv.

NAK from my side.
Please read RFC4942 2.1.9.5 "Misuse of Pad1 and PadN Options".

While it doesn't specifically discusses this corner case, you can understand from "There is no legitimate reason for padding beyond the next eight octet..." that there's also no legitimate reason for an option header containing only padding.
I can't imagine a sane use-case for this.

Quoted 1 line

Current behaviour breaks TAHI Test v6LC.1.2.6.

I'm not familiar with this, but IMHO the test should be reversed :)

Cheers,
Eldad

Quoted 29 lines

Problem was intruduced in:
9b905fe6843 "ipv6/exthdrs: strict Pad1 and PadN check"

---
 net/ipv6/exthdrs.c | 6 ------
 1 file changed, 6 deletions(-)
net/ipv6/exthdrs.c +0 -6
index 07a7d65..8d67900 100644
@@ -162,12 +162,6 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, struct sk_buff *skb)
 		off += optlen;
 		len -= optlen;
 	}
-	/* This case will not be caught by above check since its padding
-	 * length is smaller than 7:
-	 * 1 byte NH + 1 byte Length + 6 bytes Padding
-	 */
-	if ((padlen == 6) && ((off - skb_network_header_len(skb)) == 8))
-		goto bad;
 
 	if (len == 0)
 		return true;
Signature · 1 line
1.8.3.1
author
#2 lore raw
Quoted 10 lines · Sat, Sep 07, 2013 at 02:31:36PM CEST, [email protected] wrote:

Hi Jiri,

Quoted 2 lines · Jiri Pirko

In rfc4942 and rfc2460 I cannot find anything which would implicate to drop packets which have only padding in tlv.

NAK from my side.
Please read RFC4942 2.1.9.5 "Misuse of Pad1 and PadN Options".

I did.

Quoted 5 lines

While it doesn't specifically discusses this corner case, you can understand from "There is no legitimate reason for padding beyond the next eight octet..." that there's also no legitimate reason for an option header containing only padding.

Okay. I'm glad you agree with me and that we both understand the rfc the same way. And since the rfc does not say that "here's no legitimate reason for an option header containing only padding", this should be possible. I say we respect rfc and do not add stronger restrictions than it dictates. No need for them.

Quoted 1 line

I can't imagine a sane use-case for this.

rfcs are not about sanity...

Quoted 37 lines
Quoted 2 lines

Current behaviour breaks TAHI Test v6LC.1.2.6.

I'm not familiar with this, but IMHO the test should be reversed :)

Cheers,
Eldad

Quoted 29 lines

Problem was intruduced in:
9b905fe6843 "ipv6/exthdrs: strict Pad1 and PadN check"

---
 net/ipv6/exthdrs.c | 6 ------
 1 file changed, 6 deletions(-)
net/ipv6/exthdrs.c +0 -6
index 07a7d65..8d67900 100644
@@ -162,12 +162,6 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs, struct sk_buff *skb)
 		off += optlen;
 		len -= optlen;
 	}
-	/* This case will not be caught by above check since its padding
-	 * length is smaller than 7:
-	 * 1 byte NH + 1 byte Length + 6 bytes Padding
-	 */
-	if ((padlen == 6) && ((off - skb_network_header_len(skb)) == 8))
-		goto bad;
 
 	if (len == 0)
 		return true;
Signature · 1 line
1.8.3.1
#3 lore raw
Quoted 20 lines · Jiri Pirko
Quoted 10 lines · Sat, Sep 07, 2013 at 02:31:36PM CEST, [email protected] wrote:

Hi Jiri,

Quoted 2 lines · Jiri Pirko

In rfc4942 and rfc2460 I cannot find anything which would implicate to drop packets which have only padding in tlv.

NAK from my side.
Please read RFC4942 2.1.9.5 "Misuse of Pad1 and PadN Options".

I did.

Quoted 5 lines

While it doesn't specifically discusses this corner case, you can understand from "There is no legitimate reason for padding beyond the next eight octet..." that there's also no legitimate reason for an option header containing only padding.

Quoted 5 lines

Okay. I'm glad you agree with me and that we both understand the rfc the same way. And since the rfc does not say that "here's no legitimate reason for an option header containing only padding", this should be possible. I say we respect rfc and do not add stronger restrictions than it dictates. No need for them.

Strictly speaking, this RFC is informational, so it is doesn't dictate per se. I hope you don't suggest removing the other checks as well...

Quoted 3 lines
Quoted 1 line

I can't imagine a sane use-case for this.

rfcs are not about sanity...

Great, we're in agreement again :) But I think the networking code is or should be.
What IPv6 stack would generate such a packet, given that the only usage of the padding options is to align other options?
Why should I accept a packet which is most likely an artificially crafted packet (RFC 3514)?

Cheers,
Eldad

author
#4 lore raw
Quoted 24 lines · Sat, Sep 07, 2013 at 06:46:12PM CEST, [email protected] wrote:
Quoted 20 lines · Jiri Pirko
Quoted 10 lines · Sat, Sep 07, 2013 at 02:31:36PM CEST, [email protected] wrote:

Hi Jiri,

Quoted 2 lines · Jiri Pirko

In rfc4942 and rfc2460 I cannot find anything which would implicate to drop packets which have only padding in tlv.

NAK from my side.
Please read RFC4942 2.1.9.5 "Misuse of Pad1 and PadN Options".

I did.

Quoted 5 lines

While it doesn't specifically discusses this corner case, you can understand from "There is no legitimate reason for padding beyond the next eight octet..." that there's also no legitimate reason for an option header containing only padding.

Quoted 8 lines
Quoted 5 lines

Okay. I'm glad you agree with me and that we both understand the rfc the same way. And since the rfc does not say that "here's no legitimate reason for an option header containing only padding", this should be possible. I say we respect rfc and do not add stronger restrictions than it dictates. No need for them.

Strictly speaking, this RFC is informational, so it is doesn't dictate per se. I hope you don't suggest removing the other checks as well...

If there are some that just plainly assumes something and does restrictions without any solid argument, yes remove them.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

I can't imagine a sane use-case for this.

rfcs are not about sanity...

Great, we're in agreement again :) But I think the networking code is or should be.
What IPv6 stack would generate such a packet, given that the only usage of the padding options is to align other options?

But why not? I do not see anything evil about that. And rfc allows it.

Quoted 6 lines

Why should I accept a packet which is most likely an artificially crafted packet (RFC 3514)?

Cheers,
Eldad

#5 lore raw

Hello!

Quoted 17 lines · Jiri Pirko
Quoted 16 lines · Sat, Sep 07, 2013 at 06:46:12PM CEST, [email protected] wrote:
Quoted 12 lines · Jiri Pirko
Quoted 10 lines · Sat, Sep 07, 2013 at 02:31:36PM CEST, [email protected] wrote:

Hi Jiri,

Quoted 2 lines · Jiri Pirko

In rfc4942 and rfc2460 I cannot find anything which would implicate to drop packets which have only padding in tlv.

NAK from my side.
Please read RFC4942 2.1.9.5 "Misuse of Pad1 and PadN Options".

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I did.

Quoted 5 lines

While it doesn't specifically discusses this corner case, you can understand from "There is no legitimate reason for padding beyond the next eight octet..." that there's also no legitimate reason for an option header containing only padding.

There could be a legitimate reason: if a firewall wants to discard a HBH or DOH it could easily zero out the option space instead of rearranging the segment. But to make this happen in the general case all limits regarding padding options would have to be dropped, too. That said, I don't see this as an valid argument.

Quoted 16 lines
Quoted 9 lines
Quoted 6 lines

Okay. I'm glad you agree with me and that we both understand the rfc the same way. And since the rfc does not say that "here's no legitimate reason for an option header containing only padding", this should be possible. I say we respect rfc and do not add stronger restrictions than it dictates. No need for them.

Strictly speaking, this RFC is informational, so it is doesn't dictate per se. I hope you don't suggest removing the other checks as well...

If there are some that just plainly assumes something and does restrictions without any solid argument, yes remove them.

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

I can't imagine a sane use-case for this.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

rfcs are not about sanity...

Great, we're in agreement again :) But I think the networking code is or should be.
What IPv6 stack would generate such a packet, given that the only usage of the padding options is to align other options?

But why not? I do not see anything evil about that. And rfc allows it.

It is easier to generate valid ipv6 frames which are fragmented in the header chain. This makes it harder for firewalls to match packets etc.

This was a known attack vector with e.g. router advertisments and fragmentation. Filters implemented in switches could be circumvented because they did not match the fragmented RA but the host correctly did reassemble the packet.

Quoted 2 lines
Quoted 2 lines

Why should I accept a packet which is most likely an artificially crafted packet (RFC 3514)?

Of course, dropping this check won't do big harm. But I actually like the strictness of the ipv6 header chain checks and dropping this just for the IPv6 Ready Logo doesn't seem right. Perhaps one could talk to the people of tahi.org first?

Greetings,

Hannes

maintainer
#6 lore raw
In reply to Eldad Zack

From: Eldad Zack <[email protected]>
Date: Sat, 7 Sep 2013 14:31:36 +0200 (CEST)

Quoted 5 lines · Jiri Pirko
Quoted 2 lines

Current behaviour breaks TAHI Test v6LC.1.2.6.

I'm not familiar with this, but IMHO the test should be reversed :)

I think I agree with Eldad on this, and that TAHI should be adjusted to have more reasonable expectations of an implementation.

#7 lore raw

Hi.

Quoted 12 lines · David Miller

From: Eldad Zack <[email protected]>
Date: Sat, 7 Sep 2013 14:31:36 +0200 (CEST)

Quoted 5 lines · Jiri Pirko
Quoted 2 lines

Current behaviour breaks TAHI Test v6LC.1.2.6.

I'm not familiar with this, but IMHO the test should be reversed :)

I think I agree with Eldad on this, and that TAHI should be adjusted to have more reasonable expectations of an implementation.

The tests (including packet formats) are based on the test specification:
https://www.ipv6ready.org/?page=documents&tag=ipv6-core-protocols

If we want to change the tests, I think we need to consult with IPv6 Forum.

Regards,

--yoshfuji

maintainer
#8 lore raw
In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>
Date: Fri, 6 Sep 2013 16:02:25 +0200

Quoted 9 lines

In rfc4942 and rfc2460 I cannot find anything which would implicate to drop packets which have only padding in tlv.

Current behaviour breaks TAHI Test v6LC.1.2.6.

Problem was intruduced in:
9b905fe6843 "ipv6/exthdrs: strict Pad1 and PadN check"

Ok I've changed my position, applied and queued up for -stable.

Thanks.