🔍 CVE-2022-39293

8.6
CVSS Score
HIGH
2022-10-13
2026-06-17 04:58
✅ 완료

🇰🇷 한글 설명

Azure RTOS USBX의 PIMA 클래스 구현 중 ux_host_class_pima_read 함수에서 정수 언더플로우 취약점이 발견되었습니다. 공격자가 조작된 헤더 길이를 가진 USB 패킷을 전송하면 계산 오류로 인해 버퍼 오버플로우가 발생하여 시스템이 손상될 수 있습니다.

💡 쉬운 설명

USB 장치가 보내는 데이터의 길이를 계산하는 과정에서 숫자가 너무 작아져 계산 오류가 발생하는 문제입니다. 이 오류를 이용해 해커가 컴퓨터의 메모리 영역을 넘쳐흐르게 만들어 시스템을 망가뜨릴 수 있습니다.

🇺🇸 원문 (English)

Azure RTOS USBX is a high-performance USB host, device, and on-the-go (OTG) embedded stack, that is fully integrated with Azure RTOS ThreadX. The case is, in [_ux_host_class_pima_read](https://github.com/azure-rtos/usbx/blob/master/common/usbx_host_classes/src/ux_host_class_pima_read.c), there is data length from device response, returned in the very first packet, and read by [L165 code](https://github.com/azure-rtos/usbx/blob/082fd9db09a3669eca3358f10b8837a5c1635c0b/common/usbx_host_classes/src/ux_host_class_pima_read.c#L165), as header_length. Then in [L178 code](https://github.com/azure-rtos/usbx/blob/082fd9db09a3669eca3358f10b8837a5c1635c0b/common/usbx_host_classes/src/ux_host_class_pima_read.c#L178), there is a “if” branch, which check the expression of “(header_length - UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE) > data_length” where if header_length is smaller than UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE, calculation could overflow and then [L182 code](https://github.com/azure-rtos/usbx/blob/082fd9db09a3669eca3358f10b8837a5c1635c0b/common/usbx_host_classes/src/ux_host_class_pima_read.c#L182) the calculation of data_length is also overflow, this way the later [while loop start from L192](https://github.com/azure-rtos/usbx/blob/082fd9db09a3669eca3358f10b8837a5c1635c0b/common/usbx_host_classes/src/ux_host_class_pima_read.c#L192) can move data_pointer to unexpected address and cause write buffer overflow. The fix has been included in USBX release [6.1.12](https://github.com/azure-rtos/usbx/releases/tag/v6.1.12_rel). The following can be used as a workaround: Add check of `header_length`: 1. It must be greater than `UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE`. 1. It should be greater or equal to the current returned data length (`transfer_request -> ux_transfer_request_actual_length`).

📍 영향받는 시스템

Azure RTOS USBX (v6.1.12 미만 버전)

⚔️ 공격 벡터

조작된 헤더 길이를 포함한 악성 USB 장치를 연결하여 데이터 처리 과정의 정수 언더플로우 유도

🛡️ 대응 방법

USBX를 버전 6.1.12 이상으로 업데이트하거나, header_length가 최소 헤더 크기보다 크고 실제 데이터 길이보다 크거나 같은지 확인하는 로직을 추가합니다.

🔧 검증 코드

해당 소스 파일 내에 취약한 함수가 존재하는지 확인하고, 적용된 패치 버전(6.1.12 이상)인지 릴리즈 노트를 통해 검증합니다.

Shell / Script
grep -r "ux_host_class_pima_read" /path/to/usbx/source/common/usbx_host_classes/src/ux_host_class_pima_read.c

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Azure