Bug 1489446 (CVE-2017-1000250)

Summary: CVE-2017-1000250 bluez: Out-of-bounds heap read in service_search_attr_req function
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: anemec, bnocera, cbuissar, cperry, dwmw2, dzickus, security-response-team, slong, spacewar, sparks
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
An information-disclosure flaw was found in the bluetoothd implementation of the Service Discovery Protocol (SDP). A specially crafted Bluetooth device could, without prior pairing or user interaction, retrieve portions of the bluetoothd process memory, including potentially sensitive information such as Bluetooth encryption keys.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-13 04:38:33 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:
Bug Depends On: 1490008, 1490009, 1490010, 1490011, 1490911    
Bug Blocks: 1489450, 1489722, 1490075    
Attachments:
Description Flags
Proposed patch none

Description Adam Mariš 2017-09-07 13:18:08 UTC
Information disclosure vulnerability due to out-of-bounds heap read in service_search_attr_req function when processing of incoming requests in the SDP server was found. Unauthenticated attacker can exploit this vulnerability to read potentially sensitive data from heap of the bluetoothd process.

Vulnerable code:

...
        } else {
                /* continuation State exists -> get from cache */
                sdp_buf_t *pCache = sdp_get_cached_rsp(cstate);
                if (pCache) {
                        uint16_t sent = MIN(max, pCache->data_size -
                                               cstate->cStateValue.maxBytesSent);
                        pResponse = pCache->data;
                        memcpy(buf->data,
                             pResponse + cstate->cStateValue.maxBytesSent,
                             sent);
                        buf->data_size += sent;
                        cstate->cStateValue.maxBytesSent += sent;
                        if (cstate->cStateValue.maxBytesSent == pCache->data_size)
                                cstate_size = sdp_set_cstate_pdu(buf, NULL);
                        else
                                cstate_size = sdp_set_cstate_pdu(buf, cstate);
                } else {
                        status = SDP_INVALID_CSTATE;
                        SDPDBG("Non-null continuation state, but null cache buffer");
                }
        }
...

When a long response is returned to a specific search attribute request, a continuation state is returned to allow reception of additional fragments, via additional requests that contain the last continuation state sent. However, the incoming “cstate” that requests additional fragments isn’t validated properly, and thus an out-of-bounds read of the response buffer (pResponse) can be achieved, leading to information disclosure of the heap.

Comment 1 Adam Mariš 2017-09-07 13:18:11 UTC
Acknowledgments:

Name: Armis Labs

Comment 2 Adam Mariš 2017-09-07 13:24:34 UTC
Created attachment 1323098 [details]
Proposed patch

Comment 3 Andrej Nemec 2017-09-08 08:27:09 UTC
*** Bug 1489720 has been marked as a duplicate of this bug. ***

Comment 6 Adam Mariš 2017-09-12 13:18:08 UTC
External References:

https://www.armis.com/blueborne/

Comment 7 Adam Mariš 2017-09-12 13:18:38 UTC
Created bluez tracking bugs for this issue:

Affects: fedora-all [bug 1490911]

Comment 8 errata-xmlrpc 2017-09-12 19:56:04 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6
  Red Hat Enterprise Linux 7

Via RHSA-2017:2685 https://access.redhat.com/errata/RHSA-2017:2685