🔍 CVE-2026-31412

5.5
CVSS Score
MEDIUM
2026-04-10
2026-05-20 15:54
✅ 완료

🇰🇷 한글 설명

Linux 커널의 USB gadget f_mass_storage 모듈에서 check_command_size_in_blocks() 함수가 좌측 시프트 연산 시 정수 오버플로우를 검사하지 않아 발생하는 취약점입니다. 악의적인 USB 호스트가 대량 데이터를 요청하는 SCSI READ/WRITE 명령을 보내면 시프트 연산이 래핑되어 경계 검사를 우회하고 메모리 손상을 야기할 수 있습니다.

💡 쉬운 설명

USB 기기와 컴퓨터 간 데이터 크기를 계산할 때 수치가 너무 커지면 잘못 계산되는 문제입니다. 악의적인 USB 기기가 이를 이용해 메모리에 접근할 수 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_mass_storage: Fix potential integer overflow in check_command_size_in_blocks() The `check_command_size_in_blocks()` function calculates the data size in bytes by left shifting `common->data_size_from_cmnd` by the block size (`common->curlun->blkbits`). However, it does not validate whether this shift operation will cause an integer overflow. Initially, the block size is set up in `fsg_lun_open()` , and the `common->data_size_from_cmnd` is set up in `do_scsi_command()`. During initialization, there is no integer overflow check for the interaction between two variables. So if a malicious USB host sends a SCSI READ or WRITE command requesting a large amount of data (`common->data_size_from_cmnd`), the left shift operation can wrap around. This results in a truncated data size, which can bypass boundary checks and potentially lead to memory corruption or out-of-bounds accesses. Fix this by using the check_shl_overflow() macro to safely perform the shift and catch any overflows.

📍 영향받는 시스템

Linux kernel의 USB gadget f_mass_storage 모듈을 탑재한 임베디드 장치 및 커널 기반 USB 주변기기 에뮬레이션 시스템

⚔️ 공격 벡터

악의적인 USB 호스트가 SCSI READ/WRITE 명령으로 비정상적으로 큰 데이터 크기를 요청하여 정수 오버플로우 트리거

🛡️ 대응 방법

check_shl_overflow() 매크로를 사용한 안전한 시프트 연산 적용 또는 최신 커널 패치 적용

🔧 검증 코드

명령어에서 check_shl_overflow 호출이 있으면 패치 적용됨, 없으면 취약 상태

Shell / Script
grep -r 'check_shl_overflow' /usr/src/linux-*/drivers/usb/gadget/ 2>/dev/null | head -1

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

💻 영향받는 소프트웨어

Linux Kernel