🇰🇷 한글 설명
Linux 커널의 bnxt_en 드라이버에서 ethtool -w 명령을 통해 펌웨어 코어덤프를 가져올 때 경계 외 메모리 복사(out-of-bound memcpy)가 발생하는 취약점입니다. 펌웨어가 반환하는 DMA 데이터 길이가 할당된 버퍼 크기를 초과할 수 있어 메모리 오염을 유발할 수 있습니다.
💡 쉬운 설명
네트워크 장비의 정보를 가져오는 과정에서 데이터가 준비된 그릇보다 더 많이 들어와서 옆에 있는 메모리 영역을 망가뜨릴 수 있는 문제입니다. 이로 인해 시스템이 불안정해지거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bnxt_en: Fix out-of-bound memcpy() during ethtool -w
When retrieving the FW coredump using ethtool, it can sometimes cause
memory corruption:
BUG: KFENCE: memory corruption in __bnxt_get_coredump+0x3ef/0x670 [bnxt_en]
Corrupted memory at 0x000000008f0f30e8 [ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ] (in kfence-#45):
__bnxt_get_coredump+0x3ef/0x670 [bnxt_en]
ethtool_get_dump_data+0xdc/0x1a0
__dev_ethtool+0xa1e/0x1af0
dev_ethtool+0xa8/0x170
dev_ioctl+0x1b5/0x580
sock_do_ioctl+0xab/0xf0
sock_ioctl+0x1ce/0x2e0
__x64_sys_ioctl+0x87/0xc0
do_syscall_64+0x5c/0xf0
entry_SYSCALL_64_after_hwframe+0x78/0x80
...
This happens when copying the coredump segment list in
bnxt_hwrm_dbg_dma_data() with the HWRM_DBG_COREDUMP_LIST FW command.
The info->dest_buf buffer is allocated based on the number of coredump
segments returned by the FW. The segment list is then DMA'ed by
the FW and the length of the DMA is returned by FW. The driver then
copies this DMA'ed segment list to info->dest_buf.
In some cases, this DMA length may exceed the info->dest_buf length
and cause the above BUG condition. Fix it by capping the copy
length to not exceed the length of info->dest_buf. The extra
DMA data contains no useful information.
This code path is shared for the HWRM_DBG_COREDUMP_LIST and the
HWRM_DBG_COREDUMP_RETRIEVE FW commands. The buffering is different
for these 2 FW commands. To simplify the logic, we need to move
the line to adjust the buffer length for HWRM_DBG_COREDUMP_RETRIEVE
up, so that the new check to cap the copy length will work for both
commands.
📍 영향받는 시스템
bnxt_en 드라이버를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
로컬 권한을 가진 사용자가 ethtool 명령어를 사용하여 특수하게 조작된 펌웨어 코어덤프 요청을 보냄
🛡️ 대응 방법
해당 취약점이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 취약점이 해결된 패치 버전 이상인지 확인