Bug 241862

Summary: CVE-2007-1353 Bluetooth setsockopt() information leaks
Product: Red Hat Enterprise Linux 5 Reporter: Marcel Holtmann <holtmann>
Component: kernelAssignee: Don Howard <dhoward>
Status: CLOSED ERRATA QA Contact: Martin Jenner <mjenner>
Severity: low Docs Contact:
Priority: medium    
Version: 5.0CC: dhoward, dzickus, security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=low,source=redhat,reported=20070328,public=20070418
Fixed In Version: RHSA-2007-0376 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-06-14 14:55:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcel Holtmann 2007-05-31 08:17:21 UTC
Report from Ilja van Sprundel:

The Bluetooth L2CAP setsockopt code has a small information leak. Basically
there is a case where 32 bits of kernel stack memory can get leaked to userland
in l2cap_sock_setsockopt():

static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, int optlen)
{
 struct sock *sk = sock->sk;
 struct l2cap_options opts;
...
 switch (optname) {
 case L2CAP_OPTIONS:
  len = min_t(unsigned int, sizeof(opts), optlen); <-- len can be 0 !!!
  if (copy_from_user((char *) &opts, optval, len)) { <-- no data copied
   err = -EFAULT;
   break;
  }
  l2cap_pi(sk)->imtu  = opts.imtu; <-- uninit 
  l2cap_pi(sk)->omtu  = opts.omtu; <-- uninit
  break;
...
}

So optlen can be 0, so no data is copied into opts, and so whatever is on the
stack at that point will get put in the sk struct. You could use getsockopt() to
retrieve that leaked data. 

Seems the hci_sock_setsockopt() function has a very simular information leak in
the HCI_FILTER case: 

 case HCI_FILTER:
  len = min_t(unsigned int, len, sizeof(uf)); <-- can be 0
  if (copy_from_user(&uf, optval, len)) { <-- no data copied 

So uf remains uninit. A call to getsockopt can retrieved the leaked info.

Comment 1 Don Howard 2007-06-01 23:33:41 UTC
A patch addressing this issue has been included in build 2.6.18-8.1.6.el5

Comment 3 Mike Gahagan 2007-06-08 19:21:46 UTC
verified the patch is in 2.6.18-8.1.6.el5

Comment 5 Red Hat Bugzilla 2007-06-14 14:55:00 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2007-0376.html