GHSA-5w5r-mf82-595p — Cap'n Proto has Undefined Behavior in capnp
Cap'n Proto has Undefined Behavior in constant::Reader and StructSchema
Does your project use an affected capnp version?
Paste your Cargo.lock to check it for GHSA-5w5r-mf82-595p and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
Advisory Timeline
- First published January 28, 2026 (302 days ago).
- Last revised February 3, 2026 — 5 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
cargo update -p capnp --precise 0.24.0
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: crates.io (1).
| Package | Fixed In |
|---|---|
| capnp crates.io · Affected: All versions | 0.24.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-758
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
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
References
- https://github.com/capnproto/capnproto-rust/issues/605WEB
- https://github.com/capnproto/capnproto-rust/commit/7b981f4c75a975c80444cd38729bcdf12bf3eabfWEB
- https://github.com/capnproto/capnproto-rust/commit/e3aeec213e6d1b30a182bf61682a370f20d8a02cWEB
- https://github.com/capnproto/capnproto-rustPACKAGE
- https://rustsec.org/advisories/RUSTSEC-2025-0143.htmlWEB
Frequently Asked Questions
- What is GHSA-5w5r-mf82-595p?
- Cap'n Proto has Undefined Behavior in constant::Reader and StructSchema. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by GHSA-5w5r-mf82-595p?
- GHSA-5w5r-mf82-595p affects capnp. Use GeekWala's free vulnerability scanner to check your dependencies against GHSA-5w5r-mf82-595p and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
Also Known As
Related CVEs
- RUSTSEC-2026-0501CRITICAL
Shamir backup recovery accepts a share at x = 0, so a supplied share can substitute the recovered private key
- CVE-2026-69157CRITICAL
Atomic Server: Unauthenticated `/setup` invite grants write access to the entire Drive