🇰🇷 한글 설명
Linux 커널의 cdns3 USB 드라이버에서 제로 패킷(Zero Length Packet)을 처리할 때 메모리 이중 해제(Double Free) 취약점이 발생합니다. 특정 조건에서 요청된 메모리가 두 번 해제되면서 Use-After-Free 오류를 유발하여 시스템 불안정성을 초래할 수 있습니다.
💡 쉬운 설명
USB 데이터를 주고받을 때 빈 데이터(제로 패킷)를 처리하는 과정에서 이미 삭제된 메모리를 다시 삭제하려고 시도하는 오류입니다. 이로 인해 컴퓨터 시스템이 갑자기 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: cdns3: fix memory double free when handle zero packet
829 if (request->complete) {
830 spin_unlock(&priv_dev->lock);
831 usb_gadget_giveback_request(&priv_ep->endpoint,
832 request);
833 spin_lock(&priv_dev->lock);
834 }
835
836 if (request->buf == priv_dev->zlp_buf)
837 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request);
Driver append an additional zero packet request when queue a packet, which
length mod max packet size is 0. When transfer complete, run to line 831,
usb_gadget_giveback_request() will free this requestion. 836 condition is
true, so cdns3_gadget_ep_free_request() free this request again.
Log:
[ 1920.140696][ T150] BUG: KFENCE: use-after-free read in cdns3_gadget_giveback+0x134/0x2c0 [cdns3]
[ 1920.140696][ T150]
[ 1920.151837][ T150] Use-after-free read at 0x000000003d1cd10b (in kfence-#36):
[ 1920.159082][ T150] cdns3_gadget_giveback+0x134/0x2c0 [cdns3]
[ 1920.164988][ T150] cdns3_transfer_completed+0x438/0x5f8 [cdns3]
Add check at line 829, skip call usb_gadget_giveback_request() if it is
additional zero length packet request. Needn't call
usb_gadget_giveback_request() because it is allocated in this driver.
📍 영향받는 시스템
Linux kernel (cdns3 USB driver module)
⚔️ 공격 벡터
악의적으로 조작된 USB 장치를 연결하여 특정 크기의 패킷 전송을 유도함으로써 발생
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 cdns3 드라이버의 메모리 해제 로직 수정
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인