From 1eab8594eaf0b1588396784f20711ddb0db362b4 Mon Sep 17 00:00:00 2001 From: jcaesar Date: Thu, 6 Apr 2023 19:55:26 +0900 Subject: [PATCH] Add unsound ntru (#1652) * Add ntru unsoundness advisory * Remove redundant unaffected * Remove non-versions --------- Co-authored-by: pinkforest(she/her) <36498018+pinkforest@users.noreply.github.com> --- crates/ntru/RUSTSEC-0000-0000.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 crates/ntru/RUSTSEC-0000-0000.md diff --git a/crates/ntru/RUSTSEC-0000-0000.md b/crates/ntru/RUSTSEC-0000-0000.md new file mode 100644 index 0000000..5632501 --- /dev/null +++ b/crates/ntru/RUSTSEC-0000-0000.md @@ -0,0 +1,30 @@ +```toml +[advisory] +id = "RUSTSEC-0000-0000" +package = "ntru" +date = "2023-03-22" +url = "https://github.com/FrinkGlobal/ntru-rs/issues/8" +categories = ["memory-corruption"] +keywords = ["ffi", "buffer overflow"] +informational = "unsound" + +[versions] +patched = [] + +[affected.functions] +"ntru::types::PrivateKey::export" = [">= 0.4.3"] +"ntru::types::PublicKey::export" = [">= 0.4.3"] +``` + +# Unsound FFI: Wrong API usage causes write past allocated area + +The following usage causes undefined behavior. +```rust +let kp: ntru::types::KeyPair = …; +kp.get_public().export(Default::default()) +``` + +When compiled with debug assertions, the code above will trigger a `attempt to subtract with overflow` panic before UB occurs. +Other mistakes (e.g. using `EncParams` from a different key) may always trigger UB. + +Likely, older versions of this crate are also affected, but have not been tested.