Hi David,
this series fixes quite a bunch of info leaks under net/. There is also
one NULL pointer deref fix ("dccp: check ccid before..") that could be
abused for privilege escalation.
The info leak fixes might be material for stable, too. But I leave the
decision up to you.
On request, test code for all (but one) of the issues can be provided.
Regards,
Mathias
Mathias Krause (14):
atm: fix info leak in getsockopt(SO_ATMPVC)
atm: fix info leak via getsockname()
Bluetooth: HCI - Fix info leak in getsockopt(HCI_FILTER)
Bluetooth: HCI - Fix info leak via getsockname()
Bluetooth: RFCOMM - Fix info leak in getsockopt(BT_SECURITY)
Bluetooth: RFCOMM - Fix info leak in ioctl(RFCOMMGETDEVLIST)
Bluetooth: RFCOMM - Fix info leak via getsockname()
Bluetooth: L2CAP - Fix info leak via getsockname()
l2tp: fix info leak via getsockname()
llc: fix info leak via getsockname()
dccp: check ccid before dereferencing
dccp: fix info leak via getsockopt(DCCP_SOCKOPT_CCID_TX_INFO)
ipvs: fix info leak in getsockopt(IP_VS_SO_GET_TIMEOUT)
net: fix info leak in compat dev_ifconf()
net/atm/common.c | 1 +
net/atm/pvc.c | 1 +
net/bluetooth/hci_sock.c | 2 ++
net/bluetooth/l2cap_sock.c | 1 +
net/bluetooth/rfcomm/sock.c | 2 ++
net/bluetooth/rfcomm/tty.c | 2 +-
net/dccp/ccid.h | 4 ++--
net/dccp/ccids/ccid3.c | 1 +
net/l2tp/l2tp_ip6.c | 1 +
net/llc/af_llc.c | 3 +--
net/netfilter/ipvs/ip_vs_ctl.c | 1 +
net/socket.c | 1 +
12 files changed, 15 insertions(+), 5 deletions(-)
--
1.7.10.4
The ATM code fails to initialize the two padding bytes of struct
sockaddr_atmpvc inserted for alignment. Add an explicit memset(0)
before filling the structure to avoid the info leak.
Signed-off-by: Mathias Krause <redacted>
---
net/atm/common.c | 1 +
1 file changed, 1 insertion(+)
@@ -812,6 +812,7 @@ int vcc_getsockopt(struct socket *sock, int level, int optname,if(!vcc->dev||!test_bit(ATM_VF_ADDR,&vcc->flags))return-ENOTCONN;+memset(&pvc,0,sizeof(pvc));pvc.sap_family=AF_ATMPVC;pvc.sap_addr.itf=vcc->dev->number;pvc.sap_addr.vpi=vcc->vpi;
The HCI code fails to initialize the two padding bytes of struct
hci_ufilter before copying it to userland -- that for leaking two
bytes kernel stack. Add an explicit memset(0) before filling the
structure to avoid the info leak.
Signed-off-by: Mathias Krause <redacted>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <redacted>
Cc: Johan Hedberg <redacted>
---
net/bluetooth/hci_sock.c | 1 +
1 file changed, 1 insertion(+)
@@ -1009,6 +1009,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname,{structhci_filter*f=&hci_pi(sk)->filter;+memset(&uf,0,sizeof(uf));uf.type_mask=f->type_mask;uf.opcode=f->opcode;uf.event_mask[0]=*((u32*)f->event_mask+0);
The HCI code fails to initialize the hci_channel member of struct
sockaddr_hci and that for leaks two bytes kernel stack via the
getsockname() syscall. Initialize hci_channel with 0 to avoid the
info leak.
Signed-off-by: Mathias Krause <redacted>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <redacted>
Cc: Johan Hedberg <redacted>
---
net/bluetooth/hci_sock.c | 1 +
1 file changed, 1 insertion(+)
The RFCOMM code fails to initialize the two padding bytes of struct
rfcomm_dev_list_req inserted for alignment before copying it to
userland. Additionally there are two padding bytes in each instance of
struct rfcomm_dev_info. The ioctl() that for disclosures two bytes plus
dev_num times two bytes uninitialized kernel heap memory.
Allocate the memory using kzalloc() to fix this issue.
Signed-off-by: Mathias Krause <redacted>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <redacted>
Cc: Johan Hedberg <redacted>
---
net/bluetooth/rfcomm/tty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
The LLC code wrongly returns 0, i.e. "success", when the socket is
zapped. Together with the uninitialized uaddrlen pointer argument from
sys_getsockname this leads to an arbitrary memory leak of up to 128
bytes kernel stack via the getsockname() syscall.
Return an error instead when the socket is zapped to prevent the info
leak. Also remove the unnecessary memset(0). We don't directly write to
the memory pointed by uaddr but memcpy() a local structure at the end of
the function that is properly initialized.
Signed-off-by: Mathias Krause <redacted>
Cc: Arnaldo Carvalho de Melo <redacted>
---
net/llc/af_llc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
The CCID3 code fails to initialize the trailing padding bytes of struct
tfrc_tx_info added for alignment on 64 bit architectures. It that for
potentially leaks four bytes kernel stack via the getsockopt() syscall.
Add an explicit memset(0) before filling the structure to avoid the
info leak.
Signed-off-by: Mathias Krause <redacted>
Cc: Gerrit Renker <redacted>
---
net/dccp/ccids/ccid3.c | 1 +
1 file changed, 1 insertion(+)
@@ -535,6 +535,7 @@ static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len,caseDCCP_SOCKOPT_CCID_TX_INFO:if(len<sizeof(tfrc))return-EINVAL;+memset(&tfrc,0,sizeof(tfrc));tfrc.tfrctx_x=hc->tx_x;tfrc.tfrctx_x_recv=hc->tx_x_recv;tfrc.tfrctx_x_calc=hc->tx_x_calc;
The implementation of dev_ifconf() for the compat ioctl interface uses
an intermediate ifc structure allocated in userland for the duration of
the syscall. Though, it fails to initialize the padding bytes inserted
for alignment and that for leaks four bytes of kernel stack. Add an
explicit memset(0) before filling the structure to avoid the info leak.
Signed-off-by: Mathias Krause <redacted>
---
net/socket.c | 1 +
1 file changed, 1 insertion(+)
If at least one of CONFIG_IP_VS_PROTO_TCP or CONFIG_IP_VS_PROTO_UDP is
not set, __ip_vs_get_timeouts() does not fully initialize the structure
that gets copied to userland and that for leaks up to 12 bytes of kernel
stack. Add an explicit memset(0) before passing the structure to
__ip_vs_get_timeouts() to avoid the info leak.
Signed-off-by: Mathias Krause <redacted>
Cc: Wensong Zhang <redacted>
Cc: Simon Horman <horms@verge.net.au>
Cc: Julian Anastasov <ja@ssi.bg>
---
net/netfilter/ipvs/ip_vs_ctl.c | 1 +
1 file changed, 1 insertion(+)
ccid_hc_rx_getsockopt() and ccid_hc_tx_getsockopt() might be called with
a NULL ccid pointer leading to a NULL pointer dereference. This could
lead to a privilege escalation if the attacker is able to map page 0 and
prepare it with a fake ccid_ops pointer.
Signed-off-by: Mathias Krause <redacted>
Cc: Gerrit Renker <redacted>
Cc: stable@vger.kernel.org
---
net/dccp/ccid.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
The L2TP code for IPv6 fails to initialize the l2tp_unused member of
struct sockaddr_l2tpip6 and that for leaks two bytes kernel stack via
the getsockname() syscall. Initialize l2tp_unused with 0 to avoid the
info leak.
Signed-off-by: Mathias Krause <redacted>
Cc: James Chapman <jchapman@katalix.com>
---
net/l2tp/l2tp_ip6.c | 1 +
1 file changed, 1 insertion(+)
The L2CAP code fails to initialize the l2_bdaddr_type member of struct
sockaddr_l2 and the padding byte added for alignment. It that for leaks
two bytes kernel stack via the getsockname() syscall. Add an explicit
memset(0) before filling the structure to avoid the info leak.
Signed-off-by: Mathias Krause <redacted>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <redacted>
Cc: Johan Hedberg <redacted>
---
net/bluetooth/l2cap_sock.c | 1 +
1 file changed, 1 insertion(+)
The RFCOMM code fails to initialize the trailing padding byte of struct
sockaddr_rc added for alignment. It that for leaks one byte kernel stack
via the getsockname() syscall. Add an explicit memset(0) before filling
the structure to avoid the info leak.
Signed-off-by: Mathias Krause <redacted>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <redacted>
Cc: Johan Hedberg <redacted>
---
net/bluetooth/rfcomm/sock.c | 1 +
1 file changed, 1 insertion(+)
The RFCOMM code fails to initialize the key_size member of struct
bt_security before copying it to userland -- that for leaking one
byte kernel stack. Initialize key_size with 0 to avoid the info
leak.
Signed-off-by: Mathias Krause <redacted>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <redacted>
Cc: Johan Hedberg <redacted>
---
net/bluetooth/rfcomm/sock.c | 1 +
1 file changed, 1 insertion(+)
@@ -822,6 +822,7 @@ static int rfcomm_sock_getsockopt(struct socket *sock, int level, int optname, c}sec.level=rfcomm_pi(sk)->sec_level;+sec.key_size=0;len=min_t(unsignedint,len,sizeof(sec));if(copy_to_user(optval,(char*)&sec,len))
The ATM code fails to initialize the two padding bytes of struct
sockaddr_atmpvc inserted for alignment. Add an explicit memset(0)
before filling the structure to avoid the info leak.
Signed-off-by: Mathias Krause <redacted>
---
net/atm/pvc.c | 1 +
1 file changed, 1 insertion(+)
this series fixes quite a bunch of info leaks under net/. There is also
one NULL pointer deref fix ("dccp: check ccid before..") that could be
abused for privilege escalation.
The info leak fixes might be material for stable, too. But I leave the
decision up to you.
On request, test code for all (but one) of the issues can be provided.
All applied and queued up for -stable, thanks a lot.