In the Linux kernel, the following vulnerability has been resolved: RDMA/srp: fix heap information leak on a truncated SRP_CRED_REQ srp_recv_done() passes wc->byte_len to srp_process_rsp(). Он ничего не передает srp_process_cred_req() и srp_process_aer_req(), которые считывают поля фиксированного размера из буфера приема без проверки того, что эти поля были получены. Размер буфера - max_ti_iu_len, который исходит из ответа входа в систему и не проверяется.
Цель, которая рекламирует 8, а затем отправляет 8-байтовый SRP_CRED_REQ, заставляет инициатора читать req->tag из конца буфера. req->tag копируется в SRP_CRED_RSP и отправляется обратно, поэтому эти байты достигают цели. SRP_AER_REQ ведет себя так же и читает req->lun. Утечка составляет 8 байт на ответ. max_ti_iu_len также решает, из какого кэша плиты поступает буфер. С 8 буфер является объектом kmalloc-8, и чтение полностью вне его: BUG: KASAN: slab-out-of-bounds в srp_recv_done+0x172b/0x1aa0 Read размера 8 в addr ffff888104714da8 по задаче kworker/u8:3/50, которая принадлежит к кэшу kmalloc-8 размера 8 Адрес багги расположен 0 байтов справа от выделенного 8-байтного региона [ffff888104714da0, ffff888104714da8) Without KASAN plabtes Один запуск вернул ".strtab". rsp->data[3] в srp_process_rsp() имеет ту же проблему: только resp_data_len проверяется перед его чтением.
Отбросьте запрос, который короче, чем анализируемая структура, и проверьте byte_len перед чтением tsk_mgmt.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: RDMA/srp: fix heap information leak on a truncated SRP_CRED_REQ srp_recv_done() passes wc->byte_len to srp_process_rsp(). It passes nothing to srp_process_cred_req() and srp_process_aer_req(), which read fixed-size fields from the receive buffer without checking that those fields were received. The buffer size is max_ti_iu_len, which comes from the login response and is not validated. A target that advertises 8 and then sends an 8-byte SRP_CRED_REQ makes the initiator read req->tag from beyond the end of the buffer. req->tag is copied into the SRP_CRED_RSP and sent back, so those bytes reach the target. SRP_AER_REQ behaves the same way and also reads req->lun. The leak is 8 bytes per response. max_ti_iu_len also decides which slab cache the buffer comes from. With 8 the buffer is a kmalloc-8 object and the read is entirely outside it: BUG: KASAN: slab-out-of-bounds in srp_recv_done+0x172b/0x1aa0 Read of size 8 at addr ffff888104714da8 by task kworker/u8:3/50 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes to the right of allocated 8-byte region [ffff888104714da0, ffff888104714da8) Without KASAN the returned bytes are whatever is next in the slab. One run returned ".strtab". rsp->data[3] in srp_process_rsp() has the same problem: only resp_data_len is checked before it is read. Drop a request that is shorter than the structure being parsed, and check byte_len before the tsk_mgmt read.