RUSTSEC-2023-0032

Source
https://rustsec.org/advisories/RUSTSEC-2023-0032
Import Source
https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2023-0032.json
JSON Data
https://api.osv.dev/v1/vulns/RUSTSEC-2023-0032
Aliases
Published
2023-03-22T12:00:00Z
Modified
2023-11-08T04:19:06.327800Z
Summary
Unsound FFI: Wrong API usage causes write past allocated area
Details

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.

Database specific
{
    "license": "CC0-1.0"
}
References

Affected packages

crates.io / ntru

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.0.0-0

Ecosystem specific

{
    "affected_functions": null,
    "affects": {
        "os": [],
        "functions": [
            "ntru::types::PrivateKey::export",
            "ntru::types::PublicKey::export"
        ],
        "arch": []
    }
}

Database specific

{
    "cvss": null,
    "informational": "unsound",
    "categories": [
        "memory-corruption"
    ]
}