proc connector: reject unprivileged listener bumps
Subsystems (2)
PATCH 1/1 proc connector: reject unprivileged listener bumps
While PROC_CN_MCAST_LISTEN/IGNORE is entirely advisory, it was possible for an unprivileged user to turn off notifications for all listeners by sending PROC_CN_MCAST_IGNORE. Instead, require the same privileges as required for a multicast bind.
--- drivers/connector/cn_proc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/connector/cn_proc.c +8 -0
@@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, (task_active_pid_ns(current) != &init_pid_ns)) return; +/* Can only change if privileged. */ +if (!capable (CAP_NET_ADMIN )) { + err =EPERM ; + goto out; + } + mc_op = (enum proc_cn_mcast_op *)msg->data;switch (*mc_op) {case PROC_CN_MCAST_LISTEN :
@@ -325,6 +331,8 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, err =EINVAL ;break ; } + +out:cn_proc_ack (err, msg->seq, msg->ack); }
Signature · 6 lines
1.7.9.5 -- Kees Cook Chrome OS Security
Hi
Quoted 4 lines · Kees Cook
While PROC_CN_MCAST_LISTEN/IGNORE is entirely advisory, it was possible for an unprivileged user to turn off notifications for all listeners by sending
PROC_CN_MCAST_IGNORE. Instead, require the same privileges as required for a multicast bind.
Sounds resonable.
Not sure whether this is a candidate for stable release, but otherwise
Signature · 1 line
Evgeniy Polyakov
Quoted 18 lines · Kees Cook
While PROC_CN_MCAST_LISTEN/IGNORE is entirely advisory, it was possible for an unprivileged user to turn off notifications for all listeners by sending
PROC_CN_MCAST_IGNORE. Instead, require the same privileges as required for a multicast bind.Signed-off-by Kees Cook <[email protected]>Cc Evgeniy Polyakov <[email protected]>Cc Matt Helsley <[email protected]>--- drivers/connector/cn_proc.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/connector/cn_proc.c +0
-0
drivers/connector/cn_proc.c static void cn_proc_mcast_ctl(struct cn_msg *msg, · line 316
Quoted 4 lines
drivers/connector/cn_proc.c +1
-0@@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, (task_active_pid_ns(current) != &init_pid_ns)) return; +/* Can only change if privileged. */
I think this comment doesn't tell us anything above and beyond the what capability check already tells us. I think you could improve it by noting that since the connector is multicast and not namespace-safe it's not yet appropriate to use ns_capable() here.
Quoted 4 lines
drivers/connector/cn_proc.c +4
-0+if (!capable (CAP_NET_ADMIN )) { + err =EPERM ; + goto out; + }
From: Matt Helsley <[email protected]>
Date: Tue, 26 Feb 2013 09:24:41 -0800
Quoted 22 lines · Kees Cook
Quoted 21 lines
While PROC_CN_MCAST_LISTEN/IGNORE is entirely advisory, it was possible for an unprivileged user to turn off notifications for all listeners by sending
PROC_CN_MCAST_IGNORE. Instead, require the same privileges as required for a multicast bind.Signed-off-by Kees Cook <[email protected]>Cc Evgeniy Polyakov <[email protected]>Cc Matt Helsley <[email protected]>--- drivers/connector/cn_proc.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/connector/cn_proc.c +0
-0@@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, (task_active_pid_ns(current) != &init_pid_ns)) return;
Quoted 8 lines
drivers/connector/cn_proc.c static void cn_proc_mcast_ctl(struct cn_msg *msg, · line 316
Quoted 1 line
drivers/connector/cn_proc.c +1
-0+/* Can only change if privileged. */ I think this comment doesn't tell us anything above and beyond the what capability check already tells us. I think you could improve it by noting that since the connector is multicast and not namespace-safe it's not yet appropriate to use
ns_capable()here.Acked-by Matt Helsley <[email protected]>
Applied.