]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
netfilter: nfnetlink_osf: fix potential NULL dereference in ttl check
authorFernando Fernandez Mancera <fmancera@suse.de>
Fri, 17 Apr 2026 16:20:57 +0000 (18:20 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 20 Apr 2026 21:45:44 +0000 (23:45 +0200)
commit711987ba281fd806322a7cd244e98e2a81903114
tree49cd43aa6de79c50acdb7b15c4691a638eb63125
parentf5ca450087c3baf3651055e7a6de92600f827af3
netfilter: nfnetlink_osf: fix potential NULL dereference in ttl check

The nf_osf_ttl() function accessed skb->dev to perform a local interface
address lookup without verifying that the device pointer was valid.

Additionally, the implementation utilized an in_dev_for_each_ifa_rcu
loop to match the packet source address against local interface
addresses. It assumed that packets from the same subnet should not see a
decrement on the initial TTL. A packet might appear it is from the same
subnet but it actually isn't especially in modern environments with
containers and virtual switching.

Remove the device dereference and interface loop. Replace the logic with
a switch statement that evaluates the TTL according to the ttl_check.

Fixes: 11eeef41d5f6 ("netfilter: passive OS fingerprint xtables match")
Reported-by: Kito Xu (veritas501) <hxzene@gmail.com>
Closes: https://lore.kernel.org/netfilter-devel/20260414074556.2512750-1-hxzene@gmail.com/
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nfnetlink_osf.c