linux/net/ipv4/netfilter
Herbert Xu 2a0a6ebee1 [NETLINK]: Synchronous message processing.
Let's recap the problem.  The current asynchronous netlink kernel
message processing is vulnerable to these attacks:

1) Hit and run: Attacker sends one or more messages and then exits
before they're processed.  This may confuse/disable the next netlink
user that gets the netlink address of the attacker since it may
receive the responses to the attacker's messages.

Proposed solutions:

a) Synchronous processing.
b) Stream mode socket.
c) Restrict/prohibit binding.

2) Starvation: Because various netlink rcv functions were written
to not return until all messages have been processed on a socket,
it is possible for these functions to execute for an arbitrarily
long period of time.  If this is successfully exploited it could
also be used to hold rtnl forever.

Proposed solutions:

a) Synchronous processing.
b) Stream mode socket.

Firstly let's cross off solution c).  It only solves the first
problem and it has user-visible impacts.  In particular, it'll
break user space applications that expect to bind or communicate
with specific netlink addresses (pid's).

So we're left with a choice of synchronous processing versus
SOCK_STREAM for netlink.

For the moment I'm sticking with the synchronous approach as
suggested by Alexey since it's simpler and I'd rather spend
my time working on other things.

However, it does have a number of deficiencies compared to the
stream mode solution:

1) User-space to user-space netlink communication is still vulnerable.

2) Inefficient use of resources.  This is especially true for rtnetlink
since the lock is shared with other users such as networking drivers.
The latter could hold the rtnl while communicating with hardware which
causes the rtnetlink user to wait when it could be doing other things.

3) It is still possible to DoS all netlink users by flooding the kernel
netlink receive queue.  The attacker simply fills the receive socket
with a single netlink message that fills up the entire queue.  The
attacker then continues to call sendmsg with the same message in a loop.

Point 3) can be countered by retransmissions in user-space code, however
it is pretty messy.

In light of these problems (in particular, point 3), we should implement
stream mode netlink at some point.  In the mean time, here is a patch
that implements synchronous processing.  

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-05-03 14:55:09 -07:00
..
arp_tables.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
arpt_mangle.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
arptable_filter.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_amanda.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_core.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_ftp.c [NETFILTER]: Fix truncated sequence numbers in FTP helper 2005-04-25 12:00:04 -07:00
ip_conntrack_irc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_proto_generic.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_proto_icmp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_proto_sctp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_proto_tcp.c [NETFILTER]: Don't checksum CHECKSUM_UNNECESSARY skbs in TCP connection tracking 2005-05-03 14:23:50 -07:00
ip_conntrack_proto_udp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_conntrack_standalone.c [NETFILTER]: Drop conntrack reference when packet leaves IP 2005-04-25 12:01:07 -07:00
ip_conntrack_tftp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_amanda.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_core.c [NETFILTER]: Fix NAT sequence number adjustment 2005-04-24 18:41:38 -07:00
ip_nat_ftp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_helper.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_irc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_proto_icmp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_proto_tcp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_proto_udp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_proto_unknown.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_rule.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_snmp_basic.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_nat_standalone.c [NETFILTER]: Fix NAT sequence number adjustment 2005-04-24 18:41:38 -07:00
ip_nat_tftp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ip_queue.c [NETLINK]: Synchronous message processing. 2005-05-03 14:55:09 -07:00
ip_tables.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_addrtype.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_ah.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_CLASSIFY.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_CLUSTERIP.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_comment.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_connmark.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_CONNMARK.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_conntrack.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_dscp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_DSCP.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_ecn.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_ECN.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_esp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_hashlimit.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_helper.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_iprange.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_length.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_limit.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_LOG.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_mac.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_mark.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_MARK.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_MASQUERADE.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_multiport.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_NETMAP.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_NOTRACK.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_owner.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_physdev.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_pkttype.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_realm.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_recent.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_REDIRECT.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_REJECT.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_SAME.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_sctp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_state.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_tcpmss.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_TCPMSS.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_tos.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_TOS.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_ttl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipt_ULOG.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iptable_filter.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iptable_mangle.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iptable_raw.c [NETFILTER]: Missing owner-field initialization in iptable_raw 2005-05-03 14:23:13 -07:00
Kconfig Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00