xref: /freebsd/tests/sys/netpfil/pf/icmp.sh (revision 6683132d54bd6d589889e43dabdc53d35e38a028)
1# $FreeBSD$
2
3. $(atf_get_srcdir)/utils.subr
4
5atf_test_case "cve_2019_5598" "cleanup"
6cve_2019_5598_head()
7{
8	atf_set descr 'Test CVE-2019-5598'
9	atf_set require.user root
10	atf_set require.progs scapy
11}
12
13cve_2019_5598_body()
14{
15	pft_init
16
17	epair_in=$(vnet_mkepair)
18	epair_out=$(vnet_mkepair)
19	ifconfig ${epair_in}a 192.0.2.1/24 up
20	ifconfig ${epair_out}a up
21
22	vnet_mkjail alcatraz ${epair_in}b ${epair_out}b
23	jexec alcatraz ifconfig ${epair_in}b 192.0.2.2/24 up
24	jexec alcatraz ifconfig ${epair_out}b 198.51.100.2/24 up
25	jexec alcatraz sysctl net.inet.ip.forwarding=1
26	jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05
27	jexec alcatraz route add default 198.51.100.3
28	route add -net 198.51.100.0/24 192.0.2.2
29
30	jexec alcatraz pfctl -e
31	pft_set_rules alcatraz "block all" \
32		"pass in proto udp to 198.51.100.3 port 53" \
33		"pass out proto udp to 198.51.100.3 port 53"
34
35	atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-5598.py \
36		--sendif ${epair_in}a \
37		--recvif ${epair_out}a \
38		--src 192.0.2.1 \
39		--to 198.51.100.3
40}
41
42cve_2019_5598_cleanup()
43{
44	pft_cleanup
45}
46
47atf_init_test_cases()
48{
49	atf_add_test_case "cve_2019_5598"
50}
51