linux/net
Mathias Krause 3d39c3b09b xfrm_user: ensure user supplied esn replay window is valid
[ Upstream commit ecd7918745 ]

The current code fails to ensure that the netlink message actually
contains as many bytes as the header indicates. If a user creates a new
state or updates an existing one but does not supply the bytes for the
whole ESN replay window, the kernel copies random heap bytes into the
replay bitmap, the ones happen to follow the XFRMA_REPLAY_ESN_VAL
netlink attribute. This leads to following issues:

1. The replay window has random bits set confusing the replay handling
   code later on.

2. A malicious user could use this flaw to leak up to ~3.5kB of heap
   memory when she has access to the XFRM netlink interface (requires
   CAP_NET_ADMIN).

Known users of the ESN replay window are strongSwan and Steffen's
iproute2 patch (<http://patchwork.ozlabs.org/patch/85962/>). The latter
uses the interface with a bitmap supplied while the former does not.
strongSwan is therefore prone to run into issue 1.

To fix both issues without breaking existing userland allow using the
XFRMA_REPLAY_ESN_VAL netlink attribute with either an empty bitmap or a
fully specified one. For the former case we initialize the in-kernel
bitmap with zero, for the latter we copy the user supplied bitmap. For
state updates the full bitmap must be supplied.

To prevent overflows in the bitmap length calculation the maximum size
of bmp_len is limited to 128 by this patch -- resulting in a maximum
replay window of 4096 packets. This should be sufficient for all real
life scenarios (RFC 4303 recommends a default replay window size of 64).

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Martin Willi <martin@revosec.ch>
Cc: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-13 05:28:05 +09:00
..
9p net/9p: Fix kernel crash with msize 512K 2011-10-03 11:40:22 -07:00
802
8021q Revert "net: maintain namespace isolation between vlan and real device" 2012-06-10 00:33:03 +09:00
appletalk
atm atm: fix info leak via getsockname() 2012-10-02 09:47:06 -07:00
ax25 net ax25: Reorder ax25_exit to remove races. 2012-04-27 09:51:21 -07:00
batman-adv
bluetooth Bluetooth: L2CAP - Fix info leak via getsockname() 2012-10-02 09:47:21 -07:00
bridge bridge: Assign rtnl_link_ops to bridge devices created via ioctl (v2) 2012-07-16 08:47:37 -07:00
caif caif: Fix access to freed pernet memory 2012-08-09 08:27:51 -07:00
can can bcm: fix incomplete tx_setup fix 2011-11-11 09:36:45 -08:00
ceph ceph: fix file mode calculation 2011-07-19 11:25:04 -07:00
core drop_monitor: dont sleep in atomic context 2012-10-02 09:47:42 -07:00
dcb
dccp dccp: fix info leak via getsockopt(DCCP_SOCKOPT_CCID_TX_INFO) 2012-10-02 09:47:21 -07:00
decnet net: fix NULL dereferences in check_peer_redir() 2012-02-13 11:06:13 -08:00
dns_resolver
dsa
econet
ethernet net: add IFF_SKB_TX_SHARED flag to priv_flags 2011-08-15 18:31:38 -07:00
ieee802154
ipv4 net: ipv4: ipmr_expire_timer causes crash when removing net namespace 2012-10-02 09:47:22 -07:00
ipv6 ipv6: addrconf: Avoid calling netdevice notifiers with RCU read-side lock 2012-10-02 09:47:05 -07:00
ipx
irda
iucv
key
l2tp l2tp: avoid to use synchronize_rcu in tunnel free function 2012-10-02 09:47:22 -07:00
lapb
llc llc: fix info leak via getsockname() 2012-10-02 09:47:21 -07:00
mac80211 mac80211: cancel mesh path timer 2012-08-15 12:04:11 -07:00
netfilter ipvs: fix info leak in getsockopt(IP_VS_SO_GET_TIMEOUT) 2012-10-02 09:47:22 -07:00
netlabel
netlink netlink: fix possible spoofing from non-root processes 2012-10-02 09:47:22 -07:00
netrom
packet af_packet: remove BUG statement in tpacket_destruct_skb 2012-10-02 09:47:05 -07:00
phonet phonet: Check input from user before allocating 2012-04-27 09:51:19 -07:00
rds rds: set correct msg_namelen 2012-10-02 09:47:41 -07:00
rfkill
rose rose_dev: fix memcpy-bug in rose_set_mac_address 2012-04-13 08:14:05 -07:00
rxrpc
sched net_sched: gact: Fix potential panic in tcf_gact(). 2012-10-02 09:47:05 -07:00
sctp sctp: Fix list corruption resulting from freeing an association on a list 2012-08-09 08:27:51 -07:00
sunrpc svcrpc: sends on closed socket should stop immediately 2012-09-14 10:00:39 -07:00
tipc
unix
wanrouter wanmain: comparing array with NULL 2012-08-09 08:27:52 -07:00
wimax
wireless cfg80211: fix possible circular lock on reg_regdb_search() 2012-10-02 09:47:37 -07:00
x25 x25: Prevent skb overreads when checking call user data 2011-10-25 07:10:17 +02:00
xfrm xfrm_user: ensure user supplied esn replay window is valid 2012-10-13 05:28:05 +09:00
compat.c
Kconfig
Makefile
nonet.c
socket.c net: fix info leak in compat dev_ifconf() 2012-10-02 09:47:22 -07:00
sysctl_net.c
TUNABLE