GHSA-5w5r-mf82-595p
critical
Cap'n Proto has Undefined Behavior in constant::Reader and StructSchema
- Severity
- critical CVSS:4.0 by GitHub
- Published
- Last changed
- Also known as
- RUSTSEC-2025-0143
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| capnp (crates.io) | before 0.24.0, from 0.0.0-0 before 0.24.0 | GitHub Advisory Database, RustSec Advisory Database |
Classification
References
Sources
| Source | Record | Licence |
|---|---|---|
| GitHub Advisory Database | GHSA-5w5r-mf82-595p changed 2026-02-03 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2025-0143 changed 2026-01-29 | CC0-1.0 |