提交 dce766af 编写于 作者: F Florian Westphal 提交者: Patrick McHardy

netfilter: ebtables: enforce CAP_NET_ADMIN

normal users are currently allowed to set/modify ebtables rules.
Restrict it to processes with CAP_NET_ADMIN.

Note that this cannot be reproduced with unmodified ebtables binary
because it uses SOCK_RAW.
Signed-off-by: NFlorian Westphal <fwestphal@astaro.com>
Cc: stable@kernel.org
Signed-off-by: NPatrick McHardy <kaber@trash.net>
上级 aaff23a9
...@@ -1406,6 +1406,9 @@ static int do_ebt_set_ctl(struct sock *sk, ...@@ -1406,6 +1406,9 @@ static int do_ebt_set_ctl(struct sock *sk,
{ {
int ret; int ret;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
switch(cmd) { switch(cmd) {
case EBT_SO_SET_ENTRIES: case EBT_SO_SET_ENTRIES:
ret = do_replace(sock_net(sk), user, len); ret = do_replace(sock_net(sk), user, len);
...@@ -1425,6 +1428,9 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) ...@@ -1425,6 +1428,9 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
struct ebt_replace tmp; struct ebt_replace tmp;
struct ebt_table *t; struct ebt_table *t;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (copy_from_user(&tmp, user, sizeof(tmp))) if (copy_from_user(&tmp, user, sizeof(tmp)))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册