🇰🇷 한글 설명
rust-openssl 라이브러리의 aes::unwrap_key() 함수에서 출력 버퍼 크기를 확인하는 조건식이 반대로 작성되어 있습니다. 이로 인해 충분히 큰 버퍼를 제공하더라도 거부되거나, 반대로 작은 버퍼가 제공될 경우 버퍼 범위를 벗어난 쓰기(Out-of-bounds write)가 발생하여 메모리 오염을 유발할 수 있습니다.
💡 쉬운 설명
데이터를 담을 그릇의 크기를 확인하는 규칙이 거꾸로 되어 있어, 그릇보다 큰 데이터를 넣으려 할 때 프로그램이 멈추거나 그릇 밖으로 데이터가 넘쳐흐를 수 있는 문제입니다. 이 과정에서 컴퓨터의 중요한 메모리 영역이 망가질 수 있습니다.
🇺🇸 원문 (English)
rust-openssl provides OpenSSL bindings for the Rust programming language. From to before 0.10.78, aes::unwrap_key() contains an incorrect assertion: it checks that out.len() + 8 <= in_.len(), but this condition is reversed. The intended invariant is out.len() >= in_.len() - 8, ensuring the output buffer is large enough. Because of the inverted check, the function only accepts buffers at or below the minimum required size and rejects larger ones. If a smaller buffer is provided the function will write past the end of out by in_.len() - 8 - out.len() bytes, causing an out-of-bounds write from a safe public function. This vulnerability is fixed in 0.10.78.
📍 영향받는 시스템
rust-openssl versions before 0.10.78
⚔️ 공격 벡터
조작된 입력값을 통해 작은 출력 버퍼를 할당하도록 유도하여 메모리 범위를 벗어난 쓰기 유발
🛡️ 대응 방법
rust-openssl 라이브러리를 0.10.78 버전 이상으로 업데이트
🔧 검증 코드
출력된 버전 번호가 0.10.78 미만인지 확인하여 취약 여부를 판단합니다.
cargo pkgid rust-openssl | grep -oE 'rust-openssl@0\.[0-9]+\.[0-9]+' || echo 'Not installed'