Skip to content

Commit

Permalink
[NETFILTER]: Missing check for CAP_NET_ADMIN in iptables compat layer
Browse files Browse the repository at this point in the history
The 32bit compatibility layer has no CAP_NET_ADMIN check in
compat_do_ipt_get_ctl, which for example allows to list the current
iptables rules even without having that capability (the non-compat
version requires it). Other capabilities might be required to exploit
the bug (eg. CAP_NET_RAW to get the nfnetlink socket?), so a plain user
can't exploit it, but a setup actually using the posix capability system
might very well hit such a constellation of granted capabilities.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Björn Steinbrink authored and David S. Miller committed Oct 20, 2006
1 parent 206daaf commit 82fac05
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ipv4/netfilter/ip_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,9 @@ compat_do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
{
int ret;

if (!capable(CAP_NET_ADMIN))
return -EPERM;

switch (cmd) {
case IPT_SO_GET_INFO:
ret = get_info(user, len, 1);
Expand Down

0 comments on commit 82fac05

Please sign in to comment.