NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · Rust (crates.io)

GHSA-5w5r-mf82-595p: Cap'n Proto has Undefined Behavior in constant::Reader and StructSchema

criticalCVSS 4.0 9.3

The safe API functions constant::Reader::get and StructSchema::new rely on PointerReader::getrootunchecked, which can cause undefined behavior (UB) by constructing arbitrary words or schemas. Reader::get StructSchema::new This vulnerability allows safe Rust code to trigger UB, which violates Rust's safety guarantees.

Published Jan 28, 2026

Affected packages

capnp

Ecosystem
Rust (crates.io)
Affected
< 0.24.0
Fixed in
0.24.0
Check
cargo tree -i capnp

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology