Advisory

GHSA-5w5r-mf82-595p

Also known as: RUSTSEC-2025-0143

Summary

Cap'n Proto has Undefined Behavior in constant::Reader and StructSchema

Details

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.

Severity

Critical Basis: The source's own band: CRITICAL

Dates

Published
2026-01-28 16:06 UTC
Modified
2026-02-03 03:06 UTC

Affected packages and fixes

capnp

crates.io · All systems

Affected

  • introduced 0, fixed 0.24.0 (semver)

Fixed versions

0.24.0

Fix

  • Fixed version 0.24.0
    cargo update -p capnp --precise 0.24.0

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences