CVE-2026-143354: bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol
In the Linux kernel, the following vulnerability has been resolved:
bpf: Require BPFLWTREROUTE when an lwtin prog changes the protocol
When an lwtin prog returns BPFOK, bpfinput() calls originput(), the input handler of the route. This handler is for one IP version and needs a dst of the same family. But BPFLWTENCAPIP lets the prog push a header of the other IP version and thus change skb->protocol. Then the handler reads and changes a header of the other IP version. The push of an SRH also replaces the dst, because seg6lookupnexthop() puts an rt6info into the skb. Then ipforward() uses the rt6info as a struct rtable.
Drop the skb with -EINVAL when skb->protocol changes, as bpfxmit() does. Drop it also when the family of the dst changes, because skb->protocol does not always show this change. Today no such skb leaves as the prog made it. A prog works as before if it returns BPFLWTREROUTE, or if it pushes an SRH on an IPv6 route.
The commit in the first Fixes tag lets a prog change skb->protocol. The commit in the second tag adds the check to bpfxmit() only.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.120 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.66 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.7 - Compensating control
Ensure an lwt_in BPF program that changes skb->protocol returns BPF_LWT_REROUTE.
Event History
Frequently Asked Questions
Which systems need attention?
The affected scenario requires an lwt_in BPF program that changes skb->protocol, such as by using BPF_LWT_ENCAP_IP, or changes the address family of the destination. The provided information does not identify an impact for systems without such programs.
What must an lwt_in BPF program do after changing the protocol or destination family?
It must return BPF_LWT_REROUTE rather than BPF_OK. Returning BPF_OK after either change causes the fixed kernel to drop the packet with -EINVAL.
What should be done if an existing program relies on returning BPF_OK?
Update the program to return BPF_LWT_REROUTE when it changes skb->protocol or the destination family. A program that pushes an SRH on an IPv6 route continues to work as before when returning BPF_OK.