Skip to content

Commit d1eb90b

Browse files
committed
ip6_tunnel: clear skb2->cb[] in ip4ip6_err()
cve cve-2026-43037 commit-author Eric Dumazet <edumazet@google.com> commit 2edfa31 Oskar Kjos reported the following problem. ip4ip6_err() calls icmp_send() on a cloned skb whose cb[] was written by the IPv6 receive path as struct inet6_skb_parm. icmp_send() passes IPCB(skb2) to __ip_options_echo(), which interprets that cb[] region as struct inet_skb_parm (IPv4). The layouts differ: inet6_skb_parm.nhoff at offset 14 overlaps inet_skb_parm.opt.rr, producing a non-zero rr value. __ip_options_echo() then reads optlen from attacker-controlled packet data at sptr[rr+1] and copies that many bytes into dopt->__data, a fixed 40-byte stack buffer (IP_OPTIONS_DATA_FIXED_SIZE). To fix this we clear skb2->cb[], as suggested by Oskar Kjos. Also add minimal IPv4 header validation (version == 4, ihl >= 5). Fixes: c4d3efa ("[IPV6] IP6TUNNEL: Add support to IPv4 over IPv6 tunnel.") Reported-by: Oskar Kjos <oskar.kjos@hotmail.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20260326155138.2429480-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit 2edfa31) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent d801d97 commit d1eb90b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

net/ipv6/ip6_tunnel.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,16 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
603603
if (!skb2)
604604
return 0;
605605

606+
/* Remove debris left by IPv6 stack. */
607+
memset(IPCB(skb2), 0, sizeof(*IPCB(skb2)));
608+
606609
skb_dst_drop(skb2);
607610

608611
skb_pull(skb2, offset);
609612
skb_reset_network_header(skb2);
610613
eiph = ip_hdr(skb2);
614+
if (eiph->version != 4 || eiph->ihl < 5)
615+
goto out;
611616

612617
/* Try to guess incoming interface */
613618
rt = ip_route_output_ports(dev_net(skb->dev), &fl4, NULL, eiph->saddr,

0 commit comments

Comments
 (0)