ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options
Subsystems (3)
PATCH v2 1/1 ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options
This patch restricts setting Loose Source and Record Route (LSRR) and Strict Source and Record Route (SSRR) IP options to users with CAP_NET_RAW capability.
This prevents unprivileged applications from forcing packets to route through attacker-controlled nodes to leak TCP ISN and possibly other protocol information.
While LSRR and SSRR are commonly filtered in many network environments, they may still be supported and forwarded along some network paths.
RFC 7126 (Recommendations on Filtering of IPv4 Packets Containing IPv4 Options) recommend to drop these options in 4.3 and 4.4.
---
v2: use Ido's suggestion.
v1: https://lore.kernel.org/netdev/[email protected]/
net/ipv4/ip_options.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/ip_options.c +4 -0
@@ -530,6 +530,10 @@ int ip_options_get(struct net *net, struct ip_options_rcu **optp,kfree (opt);return -EINVAL ; } +if (opt->opt.srr && !ns_capable (net->user_ns,CAP_NET_RAW )) { +kfree (opt); +return -EPERM ; + }kfree (*optp); *optp = opt;return 0 ;
Signature · 1 line
2.54.0.929.g9b7fa37559-goog
Quoted 18 lines · Eric Dumazet
This patch restricts setting Loose Source and Record Route (LSRR) and Strict Source and Record Route (SSRR) IP options to users with
CAP_NET_RAWcapability.This prevents unprivileged applications from forcing packets to route through attacker-controlled nodes to leak TCP ISN and possibly other protocol information.
While LSRR and SSRR are commonly filtered in many network environments, they may still be supported and forwarded along some network paths.
RFC 7126 (Recommendations on Filtering of IPv4 Packets Containing IPv4 Options) recommend to drop these options in 4.3 and 4.4.
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Reported-by Tamir Shahar <[email protected]>Reported-by Amit Klein <[email protected]>Signed-off-by Eric Dumazet <[email protected]>
Quoted 7 lines
---
v2: use Ido's suggestion.
v1: https://lore.kernel.org/netdev/[email protected]/net/ipv4/ip_options.c | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 11 lines · Eric Dumazet
This patch restricts setting Loose Source and Record Route (LSRR) and Strict Source and Record Route (SSRR) IP options to users with
CAP_NET_RAWcapability.This prevents unprivileged applications from forcing packets to route through attacker-controlled nodes to leak TCP ISN and possibly other protocol information.
While LSRR and SSRR are commonly filtered in many network environments, they may still be supported and forwarded along some network paths.
Quoted 7 lines
RFC 7126 (Recommendations on Filtering of IPv4 Packets Containing IPv4 Options) recommend to drop these options in 4.3 and 4.4.
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Reported-by Tamir Shahar <[email protected]>Reported-by Amit Klein <[email protected]>Signed-off-by Eric Dumazet <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 2 Jun 2026 16:15:47 +0000 you wrote:
This patch restricts setting Loose Source and Record Route (LSRR) and Strict Source and Record Route (SSRR) IP options to users with
CAP_NET_RAWcapability.This prevents unprivileged applications from forcing packets to route through attacker-controlled nodes to leak TCP ISN and possibly other protocol information.
[...]
Here is the summary with links:
- [v2,net] ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options
https://git.kernel.org/netdev/net/c/d3915a1f5a4b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html