提交 78b79876 编写于 作者: V Vasiliy Kulikov 提交者: Patrick McHardy

netfilter: ip_tables: fix infoleak to userspace

Structures ipt_replace, compat_ipt_replace, and xt_get_revision are
copied from userspace.  Fields of these structs that are
zero-terminated strings are not checked.  When they are used as argument
to a format string containing "%s" in request_module(), some sensitive
information is leaked to userspace via argument of spawned modprobe
process.

The first and the third bugs were introduced before the git epoch; the
second was introduced in 2722971c (v2.6.17-rc1).  To trigger the bug
one should have CAP_NET_ADMIN.
Signed-off-by: NVasiliy Kulikov <segoon@openwall.com>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
上级 42eab94f
...@@ -1262,6 +1262,7 @@ do_replace(struct net *net, const void __user *user, unsigned int len) ...@@ -1262,6 +1262,7 @@ do_replace(struct net *net, const void __user *user, unsigned int len)
/* overflow check */ /* overflow check */
if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
return -ENOMEM; return -ENOMEM;
tmp.name[sizeof(tmp.name)-1] = 0;
newinfo = xt_alloc_table_info(tmp.size); newinfo = xt_alloc_table_info(tmp.size);
if (!newinfo) if (!newinfo)
...@@ -1807,6 +1808,7 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) ...@@ -1807,6 +1808,7 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len)
return -ENOMEM; return -ENOMEM;
if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
return -ENOMEM; return -ENOMEM;
tmp.name[sizeof(tmp.name)-1] = 0;
newinfo = xt_alloc_table_info(tmp.size); newinfo = xt_alloc_table_info(tmp.size);
if (!newinfo) if (!newinfo)
...@@ -2036,6 +2038,7 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) ...@@ -2036,6 +2038,7 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
rev.name[sizeof(rev.name)-1] = 0;
if (cmd == IPT_SO_GET_REVISION_TARGET) if (cmd == IPT_SO_GET_REVISION_TARGET)
target = 1; target = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册