🔍 CVE-2021-47391

7.8
CVSS Score
HIGH
2024-05-21
2026-08-04 10:17
✅ 완료

🇰🇷 한글 설명

Linux 커널의 RDMA/cma 구성 요소에서 상태 머신(FSM)이 순환하여 동일한 id_priv에 대해 rdma_resolve_ip()가 두 번 호출될 수 있는 취약점입니다. 이로 인해 rdma_addr_cancel()이 모든 요청을 취소하지 못하게 되어, rdma_destroy_id() 이후에도 요청이 남아 메모리를 참조하는 Use-After-Free(UAF) 오류가 발생합니다.

💡 쉬운 설명

네트워크 통신을 처리하는 과정에서 명령이 중복으로 실행되어, 이미 삭제된 메모리 영역을 다시 사용하려고 시도하는 오류입니다. 이로 인해 시스템이 충돌하거나 보안 공격에 노출될 수 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests The FSM can run in a circle allowing rdma_resolve_ip() to be called twice on the same id_priv. While this cannot happen without going through the work, it violates the invariant that the same address resolution background request cannot be active twice. CPU 1 CPU 2 rdma_resolve_addr(): RDMA_CM_IDLE -> RDMA_CM_ADDR_QUERY rdma_resolve_ip(addr_handler) #1 process_one_req(): for #1 addr_handler(): RDMA_CM_ADDR_QUERY -> RDMA_CM_ADDR_BOUND mutex_unlock(&id_priv->handler_mutex); [.. handler still running ..] rdma_resolve_addr(): RDMA_CM_ADDR_BOUND -> RDMA_CM_ADDR_QUERY rdma_resolve_ip(addr_handler) !! two requests are now on the req_list rdma_destroy_id(): destroy_id_handler_unlock(): _destroy_id(): cma_cancel_operation(): rdma_addr_cancel() // process_one_req() self removes it spin_lock_bh(&lock); cancel_delayed_work(&req->work); if (!list_empty(&req->list)) == true ! rdma_addr_cancel() returns after process_on_req #1 is done kfree(id_priv) process_one_req(): for #2 addr_handler(): mutex_lock(&id_priv->handler_mutex); !! Use after free on id_priv rdma_addr_cancel() expects there to be one req on the list and only cancels the first one. The self-removal behavior of the work only happens after the handler has returned. This yields a situations where the req_list can have two reqs for the same "handle" but rdma_addr_cancel() only cancels the first one. The second req remains active beyond rdma_destroy_id() and will use-after-free id_priv once it inevitably triggers. Fix this by remembering if the id_priv has called rdma_resolve_ip() and always cancel before calling it again. This ensures the req_list never gets more than one item in it and doesn't cost anything in the normal flow that never uses this strange error path.

📍 영향받는 시스템

RDMA/cma를 사용하는 Linux 커널 버전 (패치 적용 전)

⚔️ 공격 벡터

특수하게 조작된 RDMA 요청을 통해 상태 머신을 순환시켜 메모리 해제 후 재사용(Use-After-Free) 유도

🛡️ 대응 방법

rdma_resolve_ip() 호출 전 기존 요청을 반드시 취소하도록 커널을 최신 버전으로 업데이트

🔧 검증 코드

출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 보안 패치 버전인지 확인합니다.

Shell / Script
uname -r

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Linux Kernel