An issue was discovered in MBed OS 6.16.0. When parsing hci reports, the hci parsing software dynamically determines the length of a list of reports by reading a byte from an input stream. It then fetches the length of the first report, uses it to calculate the beginning of the second report, etc. In doing this, it tracks the largest report so it can later allocate a buffer that fits every individual report (but only one at a time). It does not, however, validate that these addresses are all contained within the buffer passed to hciEvtProcessLeExtAdvReport. It is then possible, though unlikely, that the buffer designated to hold the reports is allocated in such a way that one of these out-of-bounds length fields is contained within the new buffer. When the (n-1)th report is copied, it overwrites the length field of the nth report. This now corrupted length field is then used for a memcpy into the new buffer, which may lead to a buffer overflow.
The HCI parser in the hciEvtProcessLeExtAdvReport function dynamically determines the number of reports based on a byte read from the input stream, then determines offsets of subsequent reports based on length fields read from the input buffer — without verifying whether the indicated addresses fall within the bounds of the passed buffer. The mechanism tracks the largest report to allocate an output buffer sized accordingly. When copying the (n-1)-th report to the new buffer, the length field of the n-th report can be overwritten if this field accidentally falls within the newly allocated buffer. Such corrupted length field is then used in a memcpy operation, which can result in buffer overflow.
An attacker can cause a buffer overflow in the device memory, which potentially enables arbitrary code execution (RCE), system destabilization, or breach of confidentiality and integrity of data processed by the device.
Apply patches available from the manufacturer according to references — fix available in the mbed-ce/mbed-os repository (pull request #387 on GitHub).
Arm Mbed OS version 6.16.0 — devices using BLE stack with HCI LE Extended Advertising Reports support (code in hci_evt.c file, hciEvtProcessLeExtAdvReport function).
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HArm Mbed Os
OSArm6.16.0
Related vulnerabilities
Buffer over-reads were discovered in the CoAP library in Arm Mbed OS 5.15.3. The CoAP parser is responsible fo...
A buffer over-read was discovered in the CoAP library in Arm Mbed OS 5.15.3. The CoAP parser is responsible fo...
A buffer over-read was discovered in the CoAP library in Arm Mbed OS 5.15.3. The CoAP parser is responsible fo...
Buffer Overflow vulnerability in ARM mbed-os v.6.17.0 allows a remote attacker to execute arbitrary code via a...
An infinite loop was discovered in the CoAP library in Arm Mbed OS 5.15.3. The CoAP parser is responsible for ...