Skip to contentSkip to conversation

tcpdump chroots into /var/lib/tcpdump

PATCH New Sven Vermeulen 2 participants 2 messages Nov 18, 2012 – Nov 27, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcpdump chroots into /var/lib/tcpdump

When invoking tcpdump, the application creates a netlink_socket and then chroots into /var/lib/tcpdump.

Without the right to create a netlink_socket:
tcpdump: Can't open netlink socket 13:Permission denied

Without the right on dac_read_search and sys_chroot:
tcpdump: Couldn't chroot/chdir to '/var/lib/tcpdump': Permission denied

See also https://bugs.gentoo.org/show_bug.cgi?id=443624

---
 policy/modules/admin/netutils.te |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
policy/modules/admin/netutils.te +4 -2
index b6c221d..606948a 100644
@@ -33,10 +33,11 @@ init_system_domain(traceroute_t, traceroute_exec_t)
 #
 
 # Perform network administration operations and have raw access to the network.
-allow netutils_t self:capability { net_admin net_raw setuid setgid };
-dontaudit netutils_t self:capability sys_tty_config;
+allow netutils_t self:capability { dac_read_search net_admin net_raw setuid setgid sys_chroot };
+dontaudit netutils_t self:capability { dac_override sys_tty_config };
 allow netutils_t self:process { setcap signal_perms };
 allow netutils_t self:netlink_route_socket create_netlink_socket_perms;
+allow netutils_t self:netlink_socket create_socket_perms;
 allow netutils_t self:packet_socket create_socket_perms;
 allow netutils_t self:udp_socket create_socket_perms;
 allow netutils_t self:tcp_socket create_stream_socket_perms;
@@ -47,6 +48,7 @@ manage_files_pattern(netutils_t, netutils_tmp_t, netutils_tmp_t)
 files_tmp_filetrans(netutils_t, netutils_tmp_t, { file dir })
 
 kernel_search_proc(netutils_t)
+kernel_read_network_state(netutils_t)
 kernel_read_all_sysctls(netutils_t)
 
 corenet_all_recvfrom_unlabeled(netutils_t)
Signature · 1 line
1.7.8.6
#1 lore raw

PATCH 1/1 tcpdump chroots into /var/lib/tcpdump

Quoted 10 lines · Sven Vermeulen

When invoking tcpdump, the application creates a netlink_socket and then chroots into /var/lib/tcpdump.

Without the right to create a netlink_socket:
tcpdump: Can't open netlink socket 13:Permission denied

Without the right on dac_read_search and sys_chroot:
tcpdump: Couldn't chroot/chdir to '/var/lib/tcpdump': Permission denied

See also https://bugs.gentoo.org/show_bug.cgi?id=443624

Merged.

Quoted 32 lines
---
 policy/modules/admin/netutils.te |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
policy/modules/admin/netutils.te +4 -2
index b6c221d..606948a 100644
@@ -33,10 +33,11 @@ init_system_domain(traceroute_t, traceroute_exec_t)
 #
 
 # Perform network administration operations and have raw access to the network.
-allow netutils_t self:capability { net_admin net_raw setuid setgid };
-dontaudit netutils_t self:capability sys_tty_config;
+allow netutils_t self:capability { dac_read_search net_admin net_raw setuid setgid sys_chroot };
+dontaudit netutils_t self:capability { dac_override sys_tty_config };
 allow netutils_t self:process { setcap signal_perms };
 allow netutils_t self:netlink_route_socket create_netlink_socket_perms;
+allow netutils_t self:netlink_socket create_socket_perms;
 allow netutils_t self:packet_socket create_socket_perms;
 allow netutils_t self:udp_socket create_socket_perms;
 allow netutils_t self:tcp_socket create_stream_socket_perms;
@@ -47,6 +48,7 @@ manage_files_pattern(netutils_t, netutils_tmp_t, netutils_tmp_t)
 files_tmp_filetrans(netutils_t, netutils_tmp_t, { file dir })
 
 kernel_search_proc(netutils_t)
+kernel_read_network_state(netutils_t)
 kernel_read_all_sysctls(netutils_t)
 
 corenet_all_recvfrom_unlabeled(netutils_t)
Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com