CVE-2022-35922 Memory allocation based on untrusted length in rust-websocket
- Published
- Updated
- Exploit status
- No public exploit known
Description
Rust-WebSocket is a WebSocket (RFC6455) library written in Rust. In versions prior to 0.26.5 untrusted websocket connections can cause an out-of-memory (OOM) process abort in a client or a server. The root cause of the issue is during dataframe parsing. Affected versions would allocate a buffer based on the declared dataframe size, which may come from an untrusted source. When Vec::with_capacity fails to allocate, the default Rust allocator will abort the current process, killing all threads. This affects only sync (non-Tokio) implementation. Async version also does not limit memory, but does not use with_capacity, so DoS can happen only when bytes for oversized dataframe or message actually got delivered by the attacker. The crashes are fixed in version 0.26.5 by imposing default dataframe size limits. Affected users are advised to update to this version. Users unable to upgrade are advised to filter websocket traffic externally or to only accept trusted traffic.
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| crates.io websocket(crates.io) | < 0.26.5 | 0.26.5 |
| crates.io websocket(crates.io) | >= 0.0.0-0, < 0.26.5 | 0.26.5 |
| websockets-rs rust-websocket | = < 0.26.5 | No fix listed |
| rust-websocket project rust-websocket | < 0.26.5 | 0.26.5 |
| fedoraproject fedora | = 35 | No fix listed |
| fedoraproject fedora | = 36 | No fix listed |
References
- github.com third-party-advisory vendor-advisory
- nvd.nist.gov third-party-advisory vendor-advisory
- github.com patch third-party-advisory
- rustsec.org vendor-advisory
- lists.fedoraproject.org
- lists.fedoraproject.org
- github.com
- github.com product
- crates.io product
- FEDORA-2022-dfa24fa7d4 vendor-advisory
- FEDORA-2022-163bcf190f vendor-advisory