rust-openssl has incorrect bounds assertion in aes key wrap
High severity
GitHub Reviewed
Published
Apr 19, 2026
in
rust-openssl/rust-openssl
•
Updated Apr 27, 2026
Description
Published to the GitHub Advisory Database
Apr 22, 2026
Reviewed
Apr 22, 2026
Published by the National Vulnerability Database
Apr 24, 2026
Last updated
Apr 27, 2026
Summary
aes::unwrap_key()has an incorrect bounds assertion on the out buffer size, which can lead to out-of-bounds write.Details
aes::unwrap_key()contains an incorrect assertion: it checks thatout.len() + 8 <= in_.len(), but this condition is reversed. The intended invariant isout.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
outbyin_.len() - 8 - out.len()bytes, causing an out-of-bounds write from a safe public function.Impact
Vulnerable applications using AES keywrap and allowing attacker controlled buffer sizes could have an attacker trigger an out-of-bounds write.
References