9.8critical
Out of bounds read in xcb
- Severity
- 9.8critical CVSS:3.1 by NVD
- Exploit likelihood
- 1.75% (higher than 78% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-2xpg-3hx4-fm9rGHSA-3288-cwgw-ch86GHSA-3cj3-jrrp-9rxfGHSA-mp6r-fgw2-rxfxRUSTSEC-2021-0019
Description
An issue was discovered in the xcb crate through 2021-02-04 for Rust. It has a soundness violation because xcb::xproto::GetAtomNameReply::name() calls std::str::from_utf8_unchecked() on unvalidated bytes from an X server.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| xcb (crates.io) | before 1.0.0, from 0.0.0-0 before 1.0.0 | GitHub Advisory Database, RustSec Advisory Database |
| xcb_project xcb | up to 2021-02-04 | NVD |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.5high CVSS:2.0 | AV:N/AC:L/Au:N/C:P/I:P/A:P |
Classification
What each source says
CVE List
An issue was discovered in the xcb crate through 2021-02-04 for Rust. It has a soundness violation because xcb::xproto::GetAtomNameReply::name() calls std::str::from_utf8_unchecked() on unvalidated bytes from an X server.
GitHub Advisory Database
An issue was discovered in the xcb crate through 2021-02-04 for Rust. It has a soundness violation because there is an out-of-bounds read in xcb::xproto::change_property(), as demonstrated by a format=32 T=u8 situation where out-of-bounds bytes are sent to an X server.
GitHub Advisory Database
An issue was discovered in the xcb crate through 2021-02-04 for Rust. It has a soundness violation because transmutation to the wrong type can happen after xcb::base::cast_event uses std::mem::transmute to return a reference to an arbitrary type.
GitHub Advisory Database
The function xcb::xproto::GetPropertyReply::value() returns a slice of type T where T is an unconstrained type parameter. The raw bytes received from the X11 server are interpreted as the requested type. The users of the xcb crate are advised to only call this function with the intended types. These are u8, u16, and u32.
This issue is tracked here: https://github.com/rust-x-bindings/rust-xcb/issues/95
RustSec Advisory Database
Calls std::str::from_utf8_unchecked() without any checks
The function xcb::xproto::GetAtomNameReply::name() calls
std::str::from_utf8_unchecked() on the raw bytes that were received from the
X11 server without any validity checks. The X11 server only prevents interior
null bytes, but otherwise allows any X11 client to create an atom for arbitrary
bytes.
This issue is tracked here: https://github.com/rust-x-bindings/rust-xcb/issues/96
xcb::xproto::GetPropertyReply::value() allows arbitrary return types
The function xcb::xproto::GetPropertyReply::value() returns a slice of type
T where T is an unconstrained type parameter. The raw bytes received from
the X11 server are interpreted as the requested type.
The users of the xcb crate are advised to only call this function with the
intended types. These are u8, u16, and u32.
This issue is tracked here: https://github.com/rust-x-bindings/rust-xcb/issues/95
Out of bounds read in xcb::xproto::change_property()
xcb::xproto::change_property has (among others) the arguments format: u8 and
data: &[T]. The intended use is one of the following cases:
format = 8andT = u8format = 16andT = u16format = 32andT = u32However, this constraint is not enforced. For example, it is possible to call the function withformat = 32andT = u8. In this case, a read beyond the end of thedataslice is performed and the bytes are sent to the X11 server.
The users of the xcb crate are advised to only call this function with one of
the intended argument combinations.
This issue is tracked here: https://github.com/rust-x-bindings/rust-xcb/issues/94
'Safe' wrapper around std::mem::transmute()
The function xcb::base::cast_event() takes a reference to a
xcb::base::GenericEvent and returns a reference to an arbitrary type, as
requested by the caller (or found via type interference). The function is
implemented as a direct call to std::mem::transmute(). Since the return type
is not constrained, this allows transmution to an incorrect type or a type that
is larger than the X11 event that was passed in.
X11 events are mostly always 32 bytes large and this function works as intended.
Users are advised to only cast to the event structs provided by the xcb crate
(and hope for the best).
This issue is tracked here: https://github.com/rust-x-bindings/rust-xcb/issues/78
NVD (es)
Se detectó un problema en la crate xcb versiones hasta el 4 de Febrero de 2021 para Rust. Presenta una violación de solidez porque la función xcb::xproto::GetAtomNameReply::name() llama a la función std::str::from_utf8_unchecked() en bytes no validados de un servidor X
References
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-26955 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-2xpg-3hx4-fm9r changed 2024-03-15 | CC-BY-4.0 |
| GitHub Advisory Database | GHSA-3288-cwgw-ch86 changed 2024-03-15 | CC-BY-4.0 |
| GitHub Advisory Database | GHSA-3cj3-jrrp-9rxf changed 2024-03-15 | CC-BY-4.0 |
| GitHub Advisory Database | GHSA-mp6r-fgw2-rxfx changed 2024-03-15 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0019 changed 2024-03-15 | CC0-1.0 |
| NVD | CVE-2021-26955 changed 2026-06-17 | Public domain |