lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191122072102.248636-3-zenczykowski@gmail.com>
Date:   Thu, 21 Nov 2019 23:21:02 -0800
From:   Maciej Żenczykowski <zenczykowski@...il.com>
To:     Maciej Żenczykowski <maze@...gle.com>,
        "David S . Miller" <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, Sean Tranchetti <stranche@...eaurora.org>,
        Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>,
        Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH 3/3] net: Fail explicit unprivileged bind to local reserved ports

From: Maciej Żenczykowski <maze@...gle.com>

Reserved ports may have some special use cases which are not suitable for
use by general userspace applications. Currently, ports specified in
ip_local_reserved_ports sysctl will not be returned only in case of automatic
port assignment.

It is desirable to prevent the host from assigning the ports even in case
of explicit binds to processes without CAP_NET_BIND_SERVICE (which
hopefully know what they're doing).

Example use cases might be:
 - a port being stolen by the nic for remote serial console,
   or some other sort of debugging functionality (crash collection, gdb,
   direct access to some other microcontroller on the nic or motherboard).
 - a transparent proxy where packets are being redirected: in case a socket
   matches this connection, packets from this application would be incorrectly
   sent to one of the endpoints.

Cc: Sean Tranchetti <stranche@...eaurora.org>
Cc: Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>
Cc: Eric Dumazet <edumazet@...gle.com>
Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
---
 include/net/ip.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/net/ip.h b/include/net/ip.h
index a92f157bb115..f00e00d15155 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -353,7 +353,8 @@ static inline bool sysctl_dev_name_is_allowed(const char *name)
 
 static inline bool inet_port_requires_bind_service(struct net *net, int port)
 {
-	return port < net->ipv4.sysctl_ip_prot_sock;
+	return port < net->ipv4.sysctl_ip_prot_sock ||
+		inet_is_local_reserved_port(net, port);
 }
 
 #else
-- 
2.24.0.432.g9d3f5f5b63-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ