Advisory

RUSTSEC-2025-0143

Also known as: GHSA-5w5r-mf82-595p

Summary

Unsound APIs of public 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

Not rated by the source.

Dates

Published
2025-12-24 12:00 UTC
Modified
2026-01-29 06:11 UTC

Affected packages and fixes

capnp

crates.io · All systems

Affected

  • introduced 0.0.0-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: RustSec Advisory Database · CC0-1.0

Sources & licences