5.4medium
Cap'n Proto vulnerable to out-of-bounds read due to logic error handling list-of-list.
- Severity
- 5.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.19% (higher than 68% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-qqff-4vw4-f6hxRUSTSEC-2022-0068
Description
Cap'n Proto is a data interchange format and remote procedure call (RPC) system. Cap'n Proro prior to versions 0.7.1, 0.8.1, 0.9.2, and 0.10.3, as well as versions of Cap'n Proto's Rust implementation prior to 0.13.7, 0.14.11, and 0.15.2 are vulnerable to out-of-bounds read due to logic error handling list-of-list. This issue may lead someone to remotely segfault a peer by sending it a malicious message, if the victim performs certain actions on a list-of-pointer type. Exfiltration of memory is possible 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 in the GitHub Security Advisory. The bug is present in inlined code, therefore the fix will require rebuilding dependent applications. Cap'n Proto has C++ fixes available in versions 0.7.1, 0.8.1, 0.9.2, and 0.10.3. The `capnp` Rust crate has fixes available in versions 0.13.7, 0.14.11, and 0.15.2.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| capnproto capnproto | < 0.7.1, >= 0.8.0, < 0.8.1, >= 0.9.0, < 0.9.2, >= 0.10.0, < 0.10.3, >= 0.13.0, < 0.13.7, >= 0.14.0, < 0.14.11, >= 0.15.0, < 0.15.2, before 0.7.1 and 3 more | CVE List, NVD |
| capnp (crates.io) | from 0.15.0 before 0.15.2, from 0.14.0 before 0.14.11, before 0.13.7, from 0.0.0-0 before 0.13.7, from 0.14.0-0 before 0.14.11, from 0.15.0-0 before 0.15.2 | GitHub Advisory Database, RustSec Advisory Database |
| capnproto capnp | before 0.13.7, from 0.14.0 before 0.14.11, from 0.15.0 before 0.15.2 | NVD |
| fedoraproject fedora | 36, 37 | NVD |
All scores
| GitHub_M | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:L |
| GitHub | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:L |
| NVD | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:L |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
Cap'n Proto is a data interchange format and remote procedure call (RPC) system. Cap'n Proro prior to versions 0.7.1, 0.8.1, 0.9.2, and 0.10.3, as well as versions of Cap'n Proto's Rust implementation prior to 0.13.7, 0.14.11, and 0.15.2 are vulnerable to out-of-bounds read due to logic error handling list-of-list. This issue may lead someone to remotely segfault a peer by sending it a malicious message, if the victim performs certain actions on a list-of-pointer type. Exfiltration of memory is possible 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 in the GitHub Security Advisory. The bug is present in inlined code, therefore the fix will require rebuilding dependent applications. Cap'n Proto has C++ fixes available in versions 0.7.1, 0.8.1, 0.9.2, and 0.10.3. The `capnp` Rust crate has fixes available in versions 0.13.7, 0.14.11, and 0.15.2.
GitHub Advisory Database
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:
- git commit 25d34c67863fd960af34fc4f82a7ca3362ee74b9
- release 0.11 (future)
- release 0.10.3:
- release 0.9.2:
- release 0.8.1:
- release 0.7.1:
- release 0.5.4:
Rust fix:
capnpcrate version0.15.2,0.14.11, or0.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:
-
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 fieldfoois get/set on its own. -
Convert it into
AnyList::Reader, and then attempt to access it through that. This is much less likely; very few apps use theAnyListAPI.
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-exceptionsand not registering an alternative exception callback) then the attack may be able to proceed anyway.
RustSec Advisory Database
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.
The C++ Cap'n Proto library is also affected by this bug. See the advisory on the main Cap'n Proto repo for a succinct description of the exact circumstances in which the problem can arise.
NVD (es)
Cap'n Proto es un formato de intercambio de datos y un sistema de llamada a procedimiento remoto (RPC). Cap'n Proro anterior a las versiones 0.7.1, 0.8.1, 0.9.2 y 0.10.3, así como las versiones de la implementación Rust de Cap'n Proto anteriores a 0.13.7, 0.14.11 y 0.15.2 son vulnerable a lecturas fuera de límites debido a un error lógico al manejar la lista de listas. Este problema puede llevar a que alguien segmente remotamente a un par enviándole un mensaje malicioso, si la víctima realiza ciertas acciones en un tipo de lista de punteros. La exfiltración de memoria es posible si la víctima realiza ciertas acciones adicionales en un tipo de lista de punteros. Para ser vulnerable, una aplicación debe realizar una secuencia específica de acciones, descrita en el Aviso de seguridad de GitHub. El error está presente en el código integrado, por lo que para solucionarlo será necesario reconstruir las aplicaciones dependientes. Cap'n Proto tiene correcciones de C++ disponibles en las versiones 0.7.1, 0.8.1, 0.9.2 y 0.10.3. La caja Rust `capnp` tiene correcciones disponibles en las versiones 0.13.7, 0.14.11 y 0.15.2.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2022-46149 changed 2025-04-23 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-qqff-4vw4-f6hx changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2022-0068 changed 2026-11-09 | CC0-1.0 |
| NVD | CVE-2022-46149 changed 2026-06-17 | Public domain |