Android security tags, read closely by Lightrion

CVE-2024-43770 AI-generated analysis

platform/packages/modules/Bluetooth, system/stack/gatt (GATT server, ATT request processing)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (5 corrections). Verify against the commit before relying on it.

Adds early returns in four GATT server request handlers in system/stack/gatt/gatt_sr.cc when gatt_tcb_get_payload_size_tx() returns 0 (channel already closed), so response buffers are no longer allocated with a zero payload size and written past their end.

Root cause

In gatt_sr.cc, the functions gatts_process_primary_service_req, gatts_process_find_info, gatts_process_read_by_type_req and gatts_process_read_req get the ATT payload size from gatt_tcb_get_payload_size_tx(tcb, cid). They use it right away to size a response buffer (sizeof(BT_HDR) + payload_size + L2CAP_MIN_OFFSET) without checking that it is positive. Per the commit message, in exceptional cases the channel is already closed when the handler runs, so the function returns 0, which leads to an OOB write in later processing. One example from the context: gatt_build_primary_service_rsp writes the opcode and length byte at p = (p_msg + 1) + L2CAP_MIN_OFFSET before its 'p_msg->len + p_msg->offset > payload_size' check (lines 555-568). With a zero-sized payload area, p points at the end of the allocation, so these writes land outside it.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to January 2025 · Findings