Vulnerability CriticalRUSTSEC-2025-0143 · capnp
RUSTSEC-2025-0143: Unsound APIs of public `constant::Reader` and `StructSchema`
Short answerA security vulnerability in the capnp crate: Unsound APIs of public `constant::Reader` and `StructSchema`. GitHub rates it Critical. Fixed in 0.24.0: update to a fixed version.
| Crate | capnp |
|---|---|
| Type | Vulnerability (memory-corruption) |
| Affected versions | Before 0.24.0. |
| Fixed in | 0.24.0 |
| Severity | Critical (GitHub rating) |
| Published | 2025-12-24 |
| Last changed | 2026-01-29 |
| Also known as | GHSA-5w5r-mf82-595p |
| Affected functions | capnp::constant::Reader::get, capnp::schema::StructSchema::new |
What to do
- See which version you have:
cargo tree -i capnp(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p capnp. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplecapnp = "0.24.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
The safe API functions constant::Reader::get and StructSchema::new rely on PointerReader::get_root_unchecked, which can cause undefined behavior (UB) by constructing arbitrary words or schemas.
Reader::get
pub fn get(&self) -> Result<<T as Owned>::Reader<'static>> {
// ...
// UNSAFE: access `words` without validation
}
StructSchema::new
pub fn new(builder: RawBrandedStructSchema) -> StructSchema {
// ...
// UNSAFE: access encoded nodes without validation
}
This vulnerability allows safe Rust code to trigger UB, which violates Rust's safety guarantees.
The issue is resolved in version 0.24.0 by making constructor functions unsafe and mark the fields of struct as visible only in the crate.
References
- Package: crates.io/crates/capnp
- Advisory: rustsec.org/advisories/RUSTSEC-2025-0143.html
- Report: github.com/capnproto/capnproto-rust/issues/605
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Other advisories for capnp
Up next
Same cratecapnp: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?