Android security tags, read closely by Lightrion

CVE-2024-0030 AI-generated analysis

platform/packages/modules/Bluetooth, system/btif GATT server (btif_gatt_util.cc)

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 (4 corrections). Verify against the commit before relying on it.

Clamps the GATT server response length to GATT_MAX_ATTR_LEN and copies only that many bytes in btif_to_bta_response, instead of always copying GATT_MAX_ATTR_LEN bytes and passing through an unchecked length.

Root cause

In system/btif/src/btif_gatt_util.cc, btif_to_bta_response() converted a btgatt_response_t (p_src) into a tGATTS_RSP (p_dest). It copied p_src->attr_value.len into p_dest->attr_value.len unchanged, without checking it against GATT_MAX_ATTR_LEN. It then called memcpy(p_dest->attr_value.value, p_src->attr_value.value, GATT_MAX_ATTR_LEN) whatever the actual length was. Per the commit message, the valid size of p_src->attr_value.value depends on p_src->attr_value.len, so the fixed-size copy can read past the valid source data. Also per the commit message, p_dest->attr_value.len did not match the length of p_dest->attr_value.value, so downstream code (attp_build_value_cmd) could read out of bounds.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to February 2024 · Findings