GHSA-fq33-vmhv-48xh
JSON

medium

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

Severity
medium rating by GitHub
Published
Last changed
Also known as
RUSTSEC-2023-0032

Description

The following usage causes undefined behavior.

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

Product or packageVersionsReported by
ntru (crates.io)from 0.4.3 up to 0.5.6, from 0.0.0-0GitHub Advisory Database, RustSec Advisory Database

References

Sources

SourceRecordLicence
GitHub Advisory DatabaseGHSA-fq33-vmhv-48xh changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2023-0032 changed 2023-11-08CC0-1.0