netfilter: socket: Lookup orig tuple for IPv6 SNAT
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ eb31628e37a0a4e01fffd79dcc7f815d2357f53a · < 2bb139e483f8cbe488d19d8c1135ac3615e2668c| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
netfilter: socket: Lookup orig tuple for IPv6 SNAT
nf_sk_lookup_slow_v4 does the conntrack lookup for IPv4 packets to restore the original 5-tuple in case of SNAT, to be able to find the right socket (if any). Then socket_match() can correctly check whether the socket was transparent.
However, the IPv6 counterpart (nf_sk_lookup_slow_v6) lacks this conntrack lookup, making xt_socket fail to match on the socket when the packet was SNATed. Add the same logic to nf_sk_lookup_slow_v6.
IPv6 SNAT is used in Kubernetes clusters for pod-to-world packets, as pods' addresses are in the fd00::/8 ULA subnet and need to be replaced with the node's external address. Cilium leverages Envoy to enforce L7 policies, and Envoy uses transparent sockets. Cilium inserts an iptables prerouting rule that matches on `-m socket --transparent` and redirects the packets to localhost, but it fails to match SNATed IPv6 packets due to that missing conntrack lookup.
From the CVE record · Linux
The Linux kernel’s IPv6 socket lookup does not restore the original connection tuple for SNATed packets, so `xt_socket` can fail to match transparent sockets. In the described Cilium and Envoy setup, this prevents an iptables rule from redirecting affected IPv6 packets to localhost for L7 policy enforcement. The input does not specify an attacker path, authentication requirement, or user interaction.
Operators running Linux kernel versions without this fix should check, particularly those using Cilium and Envoy with IPv6 SNAT and transparent sockets.