Skip to contentSkip to conversation

netfilter: ipv6: stop the conntrack fragment search at AH

PATCH In review Ryosuke Iwahashi 2 participants 2 messages Nov 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 netfilter: ipv6: stop the conntrack fragment search at AH

find_prev_fhdr() looks beyond an IPv6 Authentication Header (AH) for a Fragment header. Reassembly there can change data covered by AH before IPv6 input processes AH.

Stop the search at AH. Conntrack still reassembles fragments when the Fragment header precedes AH.

Fixes 6aafeef03b9d ("netfilter: push reasm skb through instead of original frag skbs")

---
v2: Resend without line wrapping.

 net/ipv6/netfilter/nf_conntrack_reasm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +3 -6
index be72c4346f8b..9d49e3f8236b 100644
@@ -407,9 +407,9 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
 		struct ipv6_opt_hdr hdr;
 		int hdrlen;
 
-		if (!ipv6_ext_hdr(nexthdr)) {
+		/* Leave headers beyond AH for the authenticated input path. */
+		if (!ipv6_ext_hdr(nexthdr) || nexthdr == NEXTHDR_AUTH)
 			return -1;
-		}
 		if (nexthdr == NEXTHDR_NONE) {
 			pr_debug("next header is none\n");
 			return -1;
@@ -420,10 +420,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
 		}
 		if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
 			return -1;
-		if (nexthdr == NEXTHDR_AUTH)
-			hdrlen = ipv6_authlen(&hdr);
-		else
-			hdrlen = ipv6_optlen(&hdr);
+		hdrlen = ipv6_optlen(&hdr);
 
 		prevhdr = nexthdr;
 		prev_nhoff = start;
maintainer
#1 lore raw
Quoted 6 lines · Ryosuke Iwahashi

find_prev_fhdr() looks beyond an IPv6 Authentication Header (AH) for a Fragment header. Reassembly there can change data covered by AH before IPv6 input processes AH.

Stop the search at AH. Conntrack still reassembles fragments when the Fragment header precedes AH.

There are real world AH deployments?
I thought its dead and unused.

I suspect its an LLM complaining about this...?