* [PATCH] proc connector: reject unprivileged listener bumps
@ 2013-02-26 7:32 Kees Cook
2013-02-26 8:46 ` Evgeniy Polyakov
2013-02-26 17:24 ` Matt Helsley
0 siblings, 2 replies; 4+ messages in thread
From: Kees Cook @ 2013-02-26 7:32 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, netdev, Matt Helsley
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 <keescook@chromium.org>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: stable@vger.kernel.org
---
drivers/connector/cn_proc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index fce2000..1110478 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -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);
}
--
1.7.9.5
--
Kees Cook
Chrome OS Security
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] proc connector: reject unprivileged listener bumps
2013-02-26 7:32 [PATCH] proc connector: reject unprivileged listener bumps Kees Cook
@ 2013-02-26 8:46 ` Evgeniy Polyakov
2013-02-26 17:24 ` Matt Helsley
1 sibling, 0 replies; 4+ messages in thread
From: Evgeniy Polyakov @ 2013-02-26 8:46 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-kernel, netdev, Matt Helsley
Hi
On Mon, Feb 25, 2013 at 11:32:25PM -0800, Kees Cook (keescook@chromium.org) wrote:
> 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
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
--
Evgeniy Polyakov
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] proc connector: reject unprivileged listener bumps
2013-02-26 7:32 [PATCH] proc connector: reject unprivileged listener bumps Kees Cook
2013-02-26 8:46 ` Evgeniy Polyakov
@ 2013-02-26 17:24 ` Matt Helsley
2013-02-27 18:08 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Matt Helsley @ 2013-02-26 17:24 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-kernel, Evgeniy Polyakov, netdev, Matt Helsley
On Mon, Feb 25, 2013 at 11:32:25PM -0800, Kees Cook wrote:
> 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 <keescook@chromium.org>
> Cc: Evgeniy Polyakov <zbr@ioremap.net>
> Cc: Matt Helsley <matthltc@us.ibm.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/connector/cn_proc.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
> index fce2000..1110478 100644
> --- a/drivers/connector/cn_proc.c
> +++ b/drivers/connector/cn_proc.c
> @@ -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.
Acked-by: Matt Helsley <matthltc@us.ibm.com>
> + if (!capable(CAP_NET_ADMIN)) {
> + err = EPERM;
> + goto out;
> + }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] proc connector: reject unprivileged listener bumps
2013-02-26 17:24 ` Matt Helsley
@ 2013-02-27 18:08 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-02-27 18:08 UTC (permalink / raw)
To: matthltc; +Cc: keescook, linux-kernel, zbr, netdev, matthltc
From: Matt Helsley <matthltc@linux.vnet.ibm.com>
Date: Tue, 26 Feb 2013 09:24:41 -0800
> On Mon, Feb 25, 2013 at 11:32:25PM -0800, Kees Cook wrote:
>> 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 <keescook@chromium.org>
>> Cc: Evgeniy Polyakov <zbr@ioremap.net>
>> Cc: Matt Helsley <matthltc@us.ibm.com>
>> Cc: stable@vger.kernel.org
>> ---
>> drivers/connector/cn_proc.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
>> index fce2000..1110478 100644
>> --- a/drivers/connector/cn_proc.c
>> +++ b/drivers/connector/cn_proc.c
>> @@ -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.
>
> Acked-by: Matt Helsley <matthltc@us.ibm.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-27 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26 7:32 [PATCH] proc connector: reject unprivileged listener bumps Kees Cook
2013-02-26 8:46 ` Evgeniy Polyakov
2013-02-26 17:24 ` Matt Helsley
2013-02-27 18:08 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.