🇰🇷 한글 설명
OP-TEE 3.20 이상 3.22 미만의 버전에서 RSA 공개키 할당 중 지수(e)는 성공하지만 모듈러스(n) 할당이 실패할 경우, 이미 해제된 메모리를 이중으로 해제하는 취약점이 존재합니다. 이는 메모리 손상 및 잠재적인 코드 실행으로 이어질 수 있는 심각한 보안 문제입니다.
💡 쉬운 설명
시스템이 보안 키를 설정하는 과정에서 오류가 발생하면, 이미 사용한 메모리를 다시 정리하려고 시도하는 버그가 있습니다. 이 오류를 악용하면 해커가 시스템의 무결성을 해치거나 악의적인 코드를 실행할 수 있습니다.
🇺🇸 원문 (English)
OP-TEE is a Trusted Execution Environment (TEE) designed as companion to a non-secure Linux kernel running on Arm; Cortex-A cores using the TrustZone technology. Starting in version 3.20 and prior to version 3.22, `shdr_verify_signature` can make a double free. `shdr_verify_signature` used to verify a TA binary before it is loaded. To verify a signature of it, allocate a memory for RSA key. RSA key allocate function (`sw_crypto_acipher_alloc_rsa_public_key`) will try to allocate a memory (which is optee’s heap memory). RSA key is consist of exponent and modulus (represent as variable `e`, `n`) and it allocation is not atomic way, so it may succeed in `e` but fail in `n`. In this case sw_crypto_acipher_alloc_rsa_public_key` will free on `e` and return as it is failed but variable ‘e’ is remained as already freed memory address . `shdr_verify_signature` will free again that memory (which is `e`) even it is freed when it failed allocate RSA key. A patch is available in version 3.22. No known workarounds are available.
📍 영향받는 시스템
OP-TEE OS version >= 3.20 and < 3.22
⚔️ 공격 벡터
신뢰할 수 없는 TA 바이너리 서명 검증 과정을 통해 메모리 할당 오류를 유발하여 이중 해제 공격 수행
🛡️ 대응 방법
OP-TEE OS를 버전 3.22 이상으로 업데이트하여 패치 적용
🔧 검증 코드
출력된 버전 번호가 3.20 이상 3.22 미만인 경우 취약한 버전으로 판단하며, 3.22 이상이면 안전합니다.
grep -r "OPTEE_VERSION" /lib/modules/$(uname -r)/build/include/ 2>/dev/null | head -n 1