---
title: "GHSA-5w5r-mf82-595p: Cap'n Proto has Undefined Behavior in constant::Reader and StructSchema"
url: https://erroneo.us/security/ghsa/GHSA-5w5r-mf82-595p/
description: "GHSA-5w5r-mf82-595p (critical, crates.io (Rust)): Cap'n Proto has Undefined Behavior in constant::Reader and StructSchema. The safe API functions…"
type: advisory
section: "Security Digest"
date_published: 2026-01-28
date_modified: 2026-01-28
publisher: erroneo.us
author: erroneo.us Security Desk
ghsa: "GHSA-5w5r-mf82-595p"
license: All rights reserved. Quote with attribution and a link.
---

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

## Affected packages

- crates.io (Rust) `capnp` < 0.24.0 → fixed: 0.24.0

## Details

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. 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.

## Sources

- [GitHub Advisory GHSA-5w5r-mf82-595p](https://github.com/advisories/GHSA-5w5r-mf82-595p)
- [github.com](https://github.com/capnproto/capnproto-rust/issues/605)
- [github.com](https://github.com/capnproto/capnproto-rust/commit/7b981f4c75a975c80444cd38729bcdf12bf3eabf)
- [github.com](https://github.com/capnproto/capnproto-rust/commit/e3aeec213e6d1b30a182bf61682a370f20d8a02c)
- [rustsec.org](https://rustsec.org/advisories/RUSTSEC-2025-0143.html)

---
Source page: https://erroneo.us/security/ghsa/GHSA-5w5r-mf82-595p/ · Security Digest: https://erroneo.us/security/ · More: https://erroneo.us/llms.txt
