]> Git Repo - linux.git/commit
netfilter: arp_tables: init netns pointer in xt_tgchk_param struct
authorFlorian Westphal <[email protected]>
Fri, 27 Dec 2019 00:33:10 +0000 (01:33 +0100)
committerPablo Neira Ayuso <[email protected]>
Mon, 30 Dec 2019 12:09:04 +0000 (13:09 +0100)
commit1b789577f655060d98d20ed0c6f9fbd469d6ba63
treecf6c5999382d19b40688f7809a390a1ac18a5ffa
parentbd6f48546b9cb7a785344fc78058c420923d7ed8
netfilter: arp_tables: init netns pointer in xt_tgchk_param struct

We get crash when the targets checkentry function tries to make
use of the network namespace pointer for arptables.

When the net pointer got added back in 2010, only ip/ip6/ebtables were
changed to initialize it, so arptables has this set to NULL.

This isn't a problem for normal arptables because no existing
arptables target has a checkentry function that makes use of par->net.

However, direct users of the setsockopt interface can provide any
target they want as long as its registered for ARP or UNPSEC protocols.

syzkaller managed to send a semi-valid arptables rule for RATEEST target
which is enough to trigger NULL deref:

kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
RIP: xt_rateest_tg_checkentry+0x11d/0xb40 net/netfilter/xt_RATEEST.c:109
[..]
 xt_check_target+0x283/0x690 net/netfilter/x_tables.c:1019
 check_target net/ipv4/netfilter/arp_tables.c:399 [inline]
 find_check_entry net/ipv4/netfilter/arp_tables.c:422 [inline]
 translate_table+0x1005/0x1d70 net/ipv4/netfilter/arp_tables.c:572
 do_replace net/ipv4/netfilter/arp_tables.c:977 [inline]
 do_arpt_set_ctl+0x310/0x640 net/ipv4/netfilter/arp_tables.c:1456

Fixes: add67461240c1d ("netfilter: add struct net * to target parameters")
Reported-by: [email protected]
Signed-off-by: Florian Westphal <[email protected]>
Acked-by: Cong Wang <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
net/ipv4/netfilter/arp_tables.c
This page took 0.056575 seconds and 4 git commands to generate.