what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Apple updateRateSetAsyncCallback Heap Overflow

Apple updateRateSetAsyncCallback Heap Overflow
Posted Sep 22, 2017
Authored by Google Security Research, laginimaineb

A heap overflow vulnerability exists in Apple's updateRateSetAsyncCallback when handling ioctl results.

tags | advisory, overflow
systems | apple
advisories | CVE-2017-7108
SHA-256 | 5baf4461e02f823d473ce5e80cdf29107fb3e4d0bc77201b0a37d01d752ae1ba

Apple updateRateSetAsyncCallback Heap Overflow

Change Mirror Download
Apple: Heap overflow in "updateRateSetAsyncCallback" when handling ioctl results 

CVE-2017-7108


Broadcom produces Wi-Fi HardMAC SoCs which are used to handle the PHY and MAC layer processing. These chips are present in both mobile devices and Wi-Fi routers, and are capable of handling many Wi-Fi related events without delegating to the host OS. On iOS, the "AppleBCMWLANBusInterfacePCIe" driver is used in order to handle the PCIe interface and low-level communication protocols with the Wi-Fi SoC (also referred to as "dongle"). Similarly, the "AppleBCMWLANCore" driver handles the high-level protocols and the Wi-Fi configuration.

Along with the regular flow of frames transferred between the host and the dongle, the two communicate with one another via a set of "ioctls" which can be issued to read or write dongle configuration from the host. This information is exchanged using the "Control Completion" ring, rather than the regular "RX" ring.

When handling certain events, such as link status changes (indicated by the firmware-originated "WLC_E_LINK" event frame), the "AppleBCMWLANCore" driver updates the rate-set. This is done by issuing an asynchronous ioctl to the firwmare using the WLC_GET_CURR_RATESET (114) command code. Upon completion, this ioctl is handled by the "updateRateSetAsyncCallback" function, which performs the following high-level logic:

int64_t updateRateSetAsyncCallback(void* this, ..., uint64_t error_code, void **ptr_to_result_struct) {

void* result_buf = *ptr_to_result_struct;
uint8_t results[0x14];

if (error_code) {
//Handle error...
}

else if (result_buf) {
memmove(results, results_buf, 0x14);
save_rate_set((uint8_t*)this + 2196, results);
...
}

...
}

void save_rate_set(void* this, uint8_t* rate_set_buffer)
{
uint32_t num_entries = *((uint32_t*)rate_set_buffer);
*((uint16_t*)this + 2) = (uint16_t)num_entries;

if (!num_entries)
return;

uint32_t* save_ptr = (uint32_t*)((uint8_t*)this + 16);
uint8_t* rates_array = rate_set_buffer + sizeof(uint32_t);

for (uint32_t i=0; i<num_entries; i++, save_ptr += 3) {
save_ptr[-1] = rates_array[i] & 0x3F;
save_ptr[0] = rates_array[i] >> 7;
}
}

As can be seen above, both "updateRateSetAsyncCallback" and the helper function (named "save_rate_set" in the snippet above) make no attempts to validate the length field returned from the firmware in the ioctl response. As a result, an attacker controlling the firmware may choose an arbitrarily large value. Doing so will cause the copy loop in "save_rate_set" to copy data out-of-bounds into the buffer at (this + 2196). Note that the buffer's length is only 0xBC, but the attacker can cause arbitrarily many bytes to by copied. Since the data is copied from the stack buffer to which the ioctl's results were originally transferred, the OOB bytes will contain information from the stack, removing some degree of control over the copied contents.

This bug is subject to a 90 day disclosure deadline. After 90 days elapse
or a patch has been made broadly available, the bug report will become
visible to the public.




Found by: laginimaineb

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close