GHSA-5w5r-mf82-595p

Suggest an improvement
Source
https://github.com/advisories/GHSA-5w5r-mf82-595p
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/01/GHSA-5w5r-mf82-595p/GHSA-5w5r-mf82-595p.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-5w5r-mf82-595p
Aliases
Published
2026-01-28T16:06:09Z
Modified
2026-02-03T03:06:53.944791Z
Severity
  • 9.3 (Critical) CVSS_V4 - 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 CVSS Calculator
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<&lt;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.

Database specific
{
    "cwe_ids": [
        "CWE-758"
    ],
    "github_reviewed_at": "2026-01-28T16:06:09Z",
    "nvd_published_at": null,
    "severity": "CRITICAL",
    "github_reviewed": true
}
References

Affected packages

crates.io / capnp

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.24.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/01/GHSA-5w5r-mf82-595p/GHSA-5w5r-mf82-595p.json"