Bluetooth: MGMT: validate advertising TLV before type checks
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 2bb36870e8cb29949ef9acec37129cd8e70f1857 · < 1a3c8ffbb469859b076445af44bdfa6a711d483e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: MGMT: validate advertising TLV before type checks
tlv_data_is_valid() reads each advertising data field length from data[i], then inspects data[i + 1] for managed EIR types before checking that the current field still fits inside the supplied buffer.
A malformed field whose length byte is the last byte of the buffer can therefore make the parser read one byte past the advertising data.
KASAN reported the following when a malformed MGMT_OP_ADD_ADVERTISING request reached that path:
BUG: KASAN: vmalloc-out-of-bounds in tlv_data_is_valid() Read of size 1 Call trace: tlv_data_is_valid() add_advertising() hci_mgmt_cmd() hci_sock_sendmsg()
Move the existing element-length check before any type-octet inspection so each non-empty element is proven to contain its type byte before the parser looks at data[i + 1].
From the CVE record · Linux
The Linux kernel’s Bluetooth MGMT parser can read one byte past an advertising-data buffer when a malformed field’s length byte is the buffer’s last byte. A malformed MGMT_OP_ADD_ADVERTISING request can trigger the read. The input does not specify access or authentication requirements.
Engineers running Linux kernels with the affected Bluetooth MGMT advertising parser should check their kernel versions; affected versions are not specified.