RUSTSEC-2025-0143
CRITICALCap'n Proto has Undefined Behavior in constant::Reader and StructSchema
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.
- Published
- 24 Dec 2025
- Last modified
- 3 Feb 2026
- Weakness
- CWE-758
- Also known as
- GHSA-5w5r-mf82-595p
- Sources
- OSV GHSA-5w5r-mf82-595pJSONOSVJSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| OSV | GitHub | CVSS 4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| OSV | crates.io | capnp | < 0.24.0 | 0.24.0 |
| OSV | crates.io | capnp | >= 0.0.0-0, < 0.24.0 | 0.24.0 |
References
- https://github.com/capnproto/capnproto-rust/issues/605 · WEB, REPORT
- https://github.com/capnproto/capnproto-rust/commit/7b981f4c75a975c80444cd38729bcdf12bf3eabf · WEB
- https://github.com/capnproto/capnproto-rust/commit/e3aeec213e6d1b30a182bf61682a370f20d8a02c · WEB
- https://github.com/capnproto/capnproto-rust · PACKAGE
- https://rustsec.org/advisories/RUSTSEC-2025-0143.html · WEB, ADVISORY
- https://crates.io/crates/capnp · PACKAGE
History
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 24 Dec 2025)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 28 Jan 2026)