2023.09.14
CVE-2022-20229 | A-224536184 | RCE | Critical | 10, 11, 12, 12L |
---|
patch

分析
下面的函数bta_hf_client_handle_cind_list_item
中,没有对参数index做检查,而后在for循环中,直接作为数组的下标,可能导致越界写。
// bta/hf_client/bta_hf_client_at.cc
/* handles a single indicator descriptor - registers it for value changing
* events */
static void bta_hf_client_handle_cind_list_item(tBTA_HF_CLIENT_CB* client_cb,
char* name, uint32_t min,
uint32_t max, uint32_t index) {
uint8_t i = 0;
APPL_TRACE_DEBUG("%s: %lu.%s <%lu:%lu>", __func__, index, name, min, max);
/* look for a matching indicator on list of supported ones */
for (i = 0; i < BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT; i++) {
if (strcmp(name, BTA_HF_CLIENT_INDICATOR_SERVICE) == 0) {
service_index = index;
}
/* look for a match - search one sign further than indicators name to check
* for string end */
/* It will distinguish 'callheld' which could be matched by strncmp as
* 'call'. */
if (strncmp(name, bta_hf_client_indicators[i].name,
bta_hf_client_indicators[i].namelen) != 0)
continue;
/* index - enumerates value position in the incoming sequence */
/* if name matches one of the known indicators, add its incoming position */
/* to lookup table for easy value->indicator matching later, when only
* values come */
client_cb->at_cb.indicator_lookup[index] = i; // 越界写,没有对传入的index做检查
return;
}
}
这里我没有去跟bta_hf_client_handle_cind_list_item
的调用链了,但是可以快速判断的是边上的函数(如下)对index做了判断,而这个函数没有做判断。哎,为什么我没看到这里呢,还是菜!
static void bta_hf_client_handle_cind_value(tBTA_HF_CLIENT_CB* client_cb,
uint32_t index, uint32_t value) {
APPL_TRACE_DEBUG("%s: index: %u value: %u", __func__, index, value);
if (index >= BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
return;
}
HFP
Android蓝牙的HFP是指Android系统中的蓝牙功能支持的一个重要技术,它代表的是“Hands-Free Profile”(免提配置文件)。
HFP的作用就像是给你的手机添加了一个无线耳机功能,让你可以通过蓝牙连接手机和其他设备,比如耳机、车载设备等进行通话。它能让你在开车或者其他需要双手空闲的情况下,通过无线耳机和手机进行通话,避免了拿着手机通话的不便。
使用HFP,你可以通过蓝牙耳机接听和拨打电话,调整音量,甚至是拨打语音指令来控制手机。它还支持通话中的音频传输,保证你能听到清晰的声音。
此外,HFP还支持一些额外的功能,比如显示来电号码、通话记录的同步等。它通过蓝牙连接手机和其他设备,使得你可以更方便地进行通话,同时也提升了安全性,避免了因为拿着手机通话而分散注意力。
总的来说,Android蓝牙的HFP使得手机能够通过蓝牙连接其他设备,实现无线通话功能。
更多分析后面单独写吧。