CVE-2024-48981

An issue was discovered in MBed OS 6.16.0. During processing of HCI packets, the software dynamically determines the length of the packet header by looking up the identifying first byte and matching it against a table of possible lengths. The initial parsing function, hciTrSerialRxIncoming does not drop packets with invalid identifiers but also does not set a safe default for the length of unknown packets' headers, leading to a buffer overflow. This can be leveraged into an arbitrary write by an attacker. It is possible to overwrite the pointer to a not-yet-allocated buffer that is supposed to receive the contents of the packet body. One can then overwrite the state variable used by the function to determine which state of packet parsing is currently occurring. Because the buffer is allocated when the last byte of the header has been copied, the combination of having a bad header length variable that will never match the counter variable and being able to overwrite the state variable with the resulting buffer overflow can be used to advance the function to the next step while skipping the buffer allocation and resulting pointer write. The next 16 bytes from the packet body are then written wherever the corrupted data pointer is pointing.
Configurations

Configuration 1 (hide)

cpe:2.3:o:arm:mbed:6.16.0:*:*:*:*:*:*:*

History

22 Nov 2024, 17:33

Type Values Removed Values Added
Summary
  • (es) Se descubrió un problema en MBed OS 6.16.0. Durante el procesamiento de paquetes HCI, el software determina dinámicamente la longitud del encabezado del paquete buscando el primer byte de identificación y comparándolo con una tabla de longitudes posibles. La función de análisis inicial, hciTrSerialRxIncoming, no descarta los paquetes con identificadores no válidos, pero tampoco establece un valor predeterminado seguro para la longitud de los encabezados de los paquetes desconocidos, lo que provoca un desbordamiento del búfer. Un atacante puede aprovechar esto para realizar una escritura arbitraria. Es posible sobrescribir el puntero a un búfer aún no asignado que se supone que debe recibir el contenido del cuerpo del paquete. Luego, se puede sobrescribir la variable de estado utilizada por la función para determinar qué estado del análisis del paquete se está produciendo actualmente. Debido a que el búfer se asigna cuando se ha copiado el último byte del encabezado, la combinación de tener una variable de longitud de encabezado incorrecta que nunca coincidirá con la variable de contador y poder sobrescribir la variable de estado con el desbordamiento de búfer resultante se puede utilizar para avanzar la función al siguiente paso mientras se omite la asignación de búfer y la escritura del puntero resultante. Los siguientes 16 bytes del cuerpo del paquete se escriben donde sea que apunte el puntero de datos dañado.
References () https://github.com/mbed-ce/mbed-os/blob/54e8693ef4ff7e025018094f290a1d5cf380941f/connectivity/FEATURE_BLE/source/cordio/stack_adaptation/hci_tr.c#L161 - () https://github.com/mbed-ce/mbed-os/blob/54e8693ef4ff7e025018094f290a1d5cf380941f/connectivity/FEATURE_BLE/source/cordio/stack_adaptation/hci_tr.c#L161 - Product
References () https://github.com/mbed-ce/mbed-os/pull/374 - () https://github.com/mbed-ce/mbed-os/pull/374 - Issue Tracking, Vendor Advisory
CWE CWE-120
CVSS v2 : unknown
v3 : unknown
v2 : unknown
v3 : 7.5
CPE cpe:2.3:o:arm:mbed:6.16.0:*:*:*:*:*:*:*
First Time Arm mbed
Arm

20 Nov 2024, 20:15

Type Values Removed Values Added
New CVE

Information

Published : 2024-11-20 20:15

Updated : 2024-11-25 22:15


NVD link : CVE-2024-48981

Mitre link : CVE-2024-48981

CVE.ORG link : CVE-2024-48981


JSON object : View

Products Affected

arm

  • mbed
CWE
CWE-120

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')