This project might be open to known security vulnerabilities, which can be prevented by tightening the version range of affected dependencies. Find detailed information at the bottom.

Crate websocat

Dependencies

(17 total, 12 outdated, 2 possibly insecure)

CrateRequiredLatestStatus
 env_logger^0.5.90.11.3out of date
 futures=0.1.170.3.30out of date
 hyper ⚠️^0.10.131.2.0out of date
 libc^0.20.2.153up to date
 log^0.4.10.4.21up to date
 openssl-probe^0.1.20.1.5up to date
 slab_typesafe^0.10.1.3up to date
 smart-default^0.2.00.7.1out of date
 structopt^0.20.3.26out of date
 tokio-core=0.1.120.1.18out of date
 tokio-file-unix^0.4.20.6.0out of date
 tokio-io=0.1.50.1.13out of date
 tokio-process^0.1.50.2.5out of date
 tokio-signal^0.10.2.9out of date
 tokio-stdin-stdout^0.1.30.1.5up to date
 tokio-uds=0.1.50.2.7out of date
 websocket ⚠️^0.20.20.27.0out of date

Dev dependencies

(1 total, 1 outdated)

CrateRequiredLatestStatus
 tokio-timer=0.1.20.2.13out of date

Security Vulnerabilities

hyper: Lenient `hyper` header parsing of `Content-Length` could allow request smuggling

RUSTSEC-2021-0078

hyper's HTTP header parser accepted, according to RFC 7230, illegal contents inside Content-Length headers. Due to this, upstream HTTP proxies that ignore the header may still forward them along if it chooses to ignore the error.

To be vulnerable, hyper must be used as an HTTP/1 server and using an HTTP proxy upstream that ignores the header's contents but still forwards it. Due to all the factors that must line up, an attack exploiting this vulnerability is unlikely.

hyper: Integer overflow in `hyper`'s parsing of the `Transfer-Encoding` header leads to data loss

RUSTSEC-2021-0079

When decoding chunk sizes that are too large, hyper's code would encounter an integer overflow. Depending on the situation, this could lead to data loss from an incorrect total size, or in rarer cases, a request smuggling attack.

To be vulnerable, you must be using hyper for any HTTP/1 purpose, including as a client or server, and consumers must send requests or responses that specify a chunk size greater than 18 exabytes. For a possible request smuggling attack to be possible, any upstream proxies must accept a chunk size greater than 64 bits.

websocket: Unbounded memory allocation based on untrusted length

RUSTSEC-2022-0035

Impact

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.

This is a security concern for you, if

  • your server application handles untrusted websocket connections
  • OR your client application connects to untrusted websocket servers

Patches

The crashes are fixed in version 0.26.5 by imposing default dataframe size limits. Affected users are advised to update to this version.

Note that default memory limits are rather large (100MB dataframes and 200 MB messages), so they can still cause DoS in some environments (i.e. 32-bit). New API has been added to fine tune those limits for specific applications.

Workarounds

  • Migrate your project to another, maintained Websocket library like Tungstenite.
  • Accept only trusted WebSocket traffic.
  • Filter the WebSocket traffic though some kind of proxy that ensures sanity limits on messages.
  • Handle process aborts gracefully and limit process memory using OS tools.

Credits

This issue was reported by Evan Richter at ForAllSecure and found with Mayhem and Cargo Fuzz.