Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🦀 crates.io

GHSA-qqff-4vw4-f6hx

MEDIUM

Cap'n Proto and its Rust implementation vulnerable to out-of-bounds read due to logic error handling list-of-list

Also known asCVE-2022-46149RUSTSEC-2022-0068
Published
Dec 5, 2022
Updated
Nov 8, 2023
Affected
3 pkgs
Patched
3 / 3
Exploits
None indexed

EPSS Exploitation Probability

via FIRST.org ↗
0.9%probability of exploitation in next 30 days
Lower Risk53th percentile+0.65%
0.00%0.45%0.90%1.35%0.1%0.9%Dec 25Apr 26Jun 26

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Blast Radius

3 pkgs affected
🦀capnp🦀capnp🦀capnp

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.

Description

The Cap'n Proto library and capnp Rust package are vulnerable to out-of-bounds read due to logic error handling list-of-list. If a message consumer expects data of type "list of pointers", and if the consumer performs certain specific actions on such data, then a message producer can cause the consumer to read out-of-bounds memory. This could trigger a process crash in the consumer, or in some cases could allow exfiltration of private in-memory data.

Impact

  • Remotely segfault a peer by sending it a malicious message, if the victim performs certain actions on a list-of-pointer type.
  • Possible exfiltration of memory, if the victim performs additional certain actions on a list-of-pointer type.
  • To be vulnerable, an application must perform a specific sequence of actions, described below. At present, we are not aware of any vulnerable application, but we advise updating regardless.

Fixed in

Unfortunately, the bug is present in inlined code, therefore the fix will require rebuilding dependent applications.

C++ fix:

Rust fix:

  • capnp crate version 0.15.2, 0.14.11, or 0.13.7

Details

A specially-crafted pointer could escape bounds checking by exploiting inconsistent handling of pointers when a list-of-structs is downgraded to a list-of-pointers.

For an in-depth explanation of how this bug works, see David Renshaw's blog post. This details below focus only on determining whether an application is vulnerable.

In order to be vulnerable, an application must have certain properties.

First, the application must accept messages with a schema in which a field has list-of-pointer type. This includes List(Text), List(Data), List(List(T)), or List(C) where C is an interface type. In the following discussion, we will assume this field is named foo.

Second, the application must accept a message of this schema from a malicious source, where the attacker can maliciously encode the pointer representing the field foo.

Third, the application must call getFoo() to obtain a List<T>::Reader for the field, and then use it in one of the following two ways:

  1. Pass it as the parameter to another message's setFoo(), thus copying the field into a new message. Note that copying the parent struct as a whole will not trigger the bug; the bug only occurs if the specific field foo is get/set on its own.

  2. Convert it into AnyList::Reader, and then attempt to access it through that. This is much less likely; very few apps use the AnyList API.

The dynamic API equivalents of these actions (capnp/dynamic.h) are also affected.

If the application does these steps, the attacker may be able to cause the Cap'n Proto implementation to read beyond the end of the message. This could induce a segmentation fault. Or, worse, data that happened to be in memory immediately after the message might be returned as if it were part of the message. In the latter case, if the application then forwards that data back to the attacker or sends it to another third party, this could result in exfiltration of secrets.

Any exfiltration of data would have the following limitations:

  • The attacker could exfiltrate no more than 512 KiB of memory immediately following the message buffer.
    • The attacker chooses in advance how far past the end of the message to read.
    • The attacker's message itself must be larger than the exfiltrated data. Note that a sufficiently large message buffer will likely be allocated using mmap() in which case the attack will likely segfault.
  • The attack can only work if the 8 bytes immediately following the exfiltrated data contains a valid in-bounds Cap'n Proto pointer. The easiest way to achieve this is if the pointer is null, i.e. 8 bytes of zero.
    • The attacker must specify exactly how much data to exfiltrate, so must guess exactly where such a valid pointer will exist.
    • If the exfiltrated data is not followed by a valid pointer, the attack will throw an exception. If an application has chosen to ignore exceptions (e.g. by compiling with -fno-exceptions and not registering an alternative exception callback) then the attack may be able to proceed anyway.

Affected Packages

3 total 3 fixed
EcosystemPackageVulnerable rangeFix
🦀crates.iocapnp0.15.0&&< 0.15.20.15.2
🦀crates.iocapnp0.14.0&&< 0.14.110.14.11
🦀crates.iocapnpall versions0.13.7

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for capnp. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Fix

    Update capnp to 0.15.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-qqff-4vw4-f6hx is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 pinpoints whether GHSA-qqff-4vw4-f6hx is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to GHSA-qqff-4vw4-f6hx. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

The Cap'n Proto library and capnp Rust package are vulnerable to out-of-bounds read due to logic error handling list-of-list. If a message consumer expects data of type "list of pointers", and if the consumer performs certain specific actions on such data, then a message producer can cause the consumer to read out-of-bounds memory. This could trigger a process crash in the consumer, or in some cases could allow exfiltration of private in-memory data. Impact ====== - Remotely segfault a peer by sending it a malicious message, if the victim performs certain actions on a list-of-pointer type. -
O3 Security · Impact-Aware SCA

Is GHSA-qqff-4vw4-f6hx in your dependencies?

O3 detects GHSA-qqff-4vw4-f6hx across crates.io dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.