# GHSA-fq33-vmhv-48xh: ntru-rs has unsound FFI: Wrong API usage causes write past allocated area

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2023-03-22T12:00:00.000Z
- Modified: 2023-11-08T04:19:06.327Z
- Also known as: RUSTSEC-2023-0032

## 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.

(As written by GitHub Advisory Database.)

## Affected

- ntru (crates.io): from 0.4.3 up to 0.5.6; from 0.0.0-0

## References

- <https://github.com/FrinkGlobal/ntru-rs/issues/8> (report, web)
- <https://github.com/FrinkGlobal/ntru-rs> (package)
- <https://rustsec.org/advisories/RUSTSEC-2023-0032.html> (advisory, web)
- <https://crates.io/crates/ntru> (package)

## Sources

- GitHub Advisory Database: [GHSA-fq33-vmhv-48xh](https://github.com/advisories/GHSA-fq33-vmhv-48xh), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2023-0032](https://rustsec.org/advisories/RUSTSEC-2023-0032.html), CC0-1.0, modified 2023-11-08

---

Page: https://cve.day/GHSA-fq33-vmhv-48xh · Whole record: https://cve.day/GHSA-fq33-vmhv-48xh.json · Rebuilt by cve.day 2026-11-25T22:56:43.146Z
