seg6: fix the iif in the IPv6 socket control block
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ ef489749aae508e6f17886775c075f12ff919fb1 · < ae68d93354e5bf5191ee673982251864ea24dd5c| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
seg6: fix the iif in the IPv6 socket control block
When an IPv4 packet is received, the ip_rcv_core(...) sets the receiving interface index into the IPv4 socket control block (v5.16-rc4, net/ipv4/ip_input.c line 510):
IPCB(skb)->iif = skb->skb_iif;
If that IPv4 packet is meant to be encapsulated in an outer IPv6+SRH header, the seg6_do_srh_encap(...) performs the required encapsulation. In this case, the seg6_do_srh_encap function clears the IPv6 socket control block (v5.16-rc4 net/ipv6/seg6_iptunnel.c line 163):
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
The memset(...) was introduced in commit ef489749aae5 ("ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation") a long time ago (2019-01-29).
Since the IPv6 socket control block and the IPv4 socket control block share the same memory area (skb->cb), the receiving interface index info is lost (IP6CB(skb)->iif is set to zero).
From the CVE record · Linux
The Linux kernel's seg6 encapsulation path can erase the receiving interface index when an IPv4 packet is encapsulated in an outer IPv6 and Segment Routing Header. If the kernel also includes the IPv6 forwarding receive-statistics change identified in the report, processing such a packet can trigger a NULL pointer dereference. The input does not specify authentication or user-interaction requirements.
Engineers running Linux kernels with seg6 encapsulation and the IPv6 forwarding receive-statistics change should check their builds; affected versions are not specified.