Skip to content
OpenAdvisories
Medium GHSA-fq33-vmhv-48xh RUSTSEC-2023-0032

ntru-rs has unsound FFI: Wrong API usage causes write past allocated area

Published Apr 7, 2023 · Updated Nov 8, 2023 · Assigned by GHSA

Description

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.

Affected packages

EcosystemPackageAffectedFixedRecord
crates.io ntru >= 0.4.3, <= 0.5.6 — GHSA-fq33-vmhv-48xh
crates.io ntru >= 0.0.0-0 — RUSTSEC-2023-0032

References