New issue
Advanced search Search tips
Starred by 1 user
Status: Fixed
Owner:
Closed: May 2016
Cc:



Sign in to add a comment
OS X kernel OOB read of object pointer due to insufficient checks in raw cast to enum type
Project Member Reported by ianbeer@google.com, Mar 22 2016 Back to list
The IOHIDFamily function IOHIDDevice::handleReportWithTime takes at attacker controlled unchecked IOHIDReportType enum,
which was cast from an int in either IOHIDLibUserClient::_setReport or _getReport:

            ret = target->setReport(arguments->structureInput, arguments->structureInputSize, (IOHIDReportType)arguments->scalarInput[0]

handleReportWithTime only checks that the enum is <= the max, but enums are really just (signed) ints so there needs to be a lower-bounds
check here too:

    if ( reportType >= kIOHIDReportTypeCount )
              return kIOReturnBadArgument;

reportType is then used here:
        element = GetHeadElement( GetReportHandlerSlot(reportID),
                                  reportType);

        while ( element ) {
            shouldTickle |= element->shouldTickleActivity();
            changed |= element->processReport( reportID,

where GetHeadElement is defined as:

#define GetHeadElement(slot, type)  _reportHandlers[slot].head[type]

This leads to an OOB read off the head array followed by virtual function calls

Tested on OS X 10.11.4 (15E65) on MacBookAir 5,2

Note that repro'ing this might be more involved on other models as there are a lot of different HID devices and drivers.

I can provide panic logs if required.
 
hidlib_oob.c
4.1 KB View Download
Project Member Comment 1 by ianbeer@google.com, Mar 22 2016
Labels: Id-638125710 Reported-2016-Mar-22
Project Member Comment 2 by ianbeer@google.com, May 18 2016
Labels: Fixed-2016-May-16 CVE-2016-1823 Product-iOS
Status: Fixed
iOS advisory: https://support.apple.com/en-us/HT206568
OS X advisory: https://support.apple.com/en-us/HT206567
Project Member Comment 3 by ianbeer@google.com, Jun 9 2016
Labels: -Restrict-View-Commit
Sign in to add a comment