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 librqbit

Dependencies

(58 total, 1 outdated, 3 possibly insecure)

CrateRequiredLatestStatus
 anyhow^11.0.99up to date
 arc-swap^1.7.11.7.1up to date
 async-backtrace^0.20.2.7up to date
 async-compression^0.4.180.4.28up to date
 async-stream^0.3.50.3.6up to date
 async-trait^0.1.810.1.89up to date
 axum^0.80.8.4up to date
 backoff^0.4.00.4.0up to date
 base64^0.220.22.1up to date
 librqbit-bencode^3.13.1.0up to date
 bincode^22.0.1up to date
 bitvec^11.0.1up to date
 librqbit-buffers^4.24.2.0up to date
 byteorder^11.5.0up to date
 bytes^1.5.01.10.1up to date
 librqbit-clone-to-owned^33.0.1up to date
 console-subscriber^0.40.4.1up to date
 dashmap^66.1.0up to date
 librqbit-dht^5.3.15.3.1up to date
 futures^0.30.3.31up to date
 governor^0.100.10.1up to date
 hex^0.40.4.3up to date
 home^0.50.5.11up to date
 http^11.3.1up to date
 intervaltree^0.2.70.2.7up to date
 itertools^0.140.14.0up to date
 librqbit-core^55.0.0up to date
 librqbit-upnp^11.0.0up to date
 lru^0.140.16.0out of date
 memmap2^0.9.40.9.8up to date
 mime_guess^2.0.52.0.5up to date
 notify^88.2.0up to date
 parking_lot^0.120.12.4up to date
 librqbit-peer-protocol^4.34.3.0up to date
 rand^0.90.9.2up to date
 regex ⚠️^11.11.2maybe insecure
 reqwest^0.120.12.23up to date
 rlimit^0.10.10.10.2up to date
 serde^11.0.219up to date
 serde_json^11.0.143up to date
 serde_urlencoded^0.70.7.1up to date
 serde_with^3.4.03.14.0up to date
 librqbit-sha1-wrapper^4.14.1.0up to date
 size_format^11.0.2up to date
 sqlx ⚠️^0.80.8.6maybe insecure
 tokio ⚠️^11.47.1maybe insecure
 tokio-socks^0.5.20.5.2up to date
 tokio-stream^0.10.1.17up to date
 tokio-util^0.7.100.7.16up to date
 tower-http^0.60.6.6up to date
 tracing^0.1.400.1.41up to date
 tracing-subscriber^0.30.3.19up to date
 librqbit-tracker-comms^33.0.0up to date
 librqbit-upnp-serve^11.0.1up to date
 url^2.5.22.5.7up to date
 urlencoding^22.1.3up to date
 uuid^1.21.18.0up to date
 walkdir^2.5.02.5.0up to date

Dev dependencies

(3 total, all up-to-date)

CrateRequiredLatestStatus
 tempfile^33.21.0up to date
 tokio-test^0.40.4.4up to date
 tracing-subscriber^0.30.3.19up to date

Security Vulnerabilities

regex: Regexes with large repetitions on empty sub-expressions take a very long time to parse

RUSTSEC-2022-0013

The Rust Security Response WG was notified that the regex crate did not properly limit the complexity of the regular expressions (regex) it parses. An attacker could use this security issue to perform a denial of service, by sending a specially crafted regex to a service accepting untrusted regexes. No known vulnerability is present when parsing untrusted input with trusted regexes.

This issue has been assigned CVE-2022-24713. The severity of this vulnerability is "high" when the regex crate is used to parse untrusted regexes. Other uses of the regex crate are not affected by this vulnerability.

Overview

The regex crate features built-in mitigations to prevent denial of service attacks caused by untrusted regexes, or untrusted input matched by trusted regexes. Those (tunable) mitigations already provide sane defaults to prevent attacks. This guarantee is documented and it's considered part of the crate's API.

Unfortunately a bug was discovered in the mitigations designed to prevent untrusted regexes to take an arbitrary amount of time during parsing, and it's possible to craft regexes that bypass such mitigations. This makes it possible to perform denial of service attacks by sending specially crafted regexes to services accepting user-controlled, untrusted regexes.

Affected versions

All versions of the regex crate before or equal to 1.5.4 are affected by this issue. The fix is include starting from regex 1.5.5.

Mitigations

We recommend everyone accepting user-controlled regexes to upgrade immediately to the latest version of the regex crate.

Unfortunately there is no fixed set of problematic regexes, as there are practically infinite regexes that could be crafted to exploit this vulnerability. Because of this, we do not recommend denying known problematic regexes.

Acknowledgements

We want to thank Addison Crump for responsibly disclosing this to us according to the Rust security policy, and for helping review the fix.

We also want to thank Andrew Gallant for developing the fix, and Pietro Albini for coordinating the disclosure and writing this advisory.

tokio: reject_remote_clients Configuration corruption

RUSTSEC-2023-0001

On Windows, configuring a named pipe server with pipe_mode will force ServerOptions::reject_remote_clients as false.

This drops any intended explicit configuration for the reject_remote_clients that may have been set as true previously.

The default setting of reject_remote_clients is normally true meaning the default is also overridden as false.

Workarounds

Ensure that pipe_mode is set first after initializing a ServerOptions. For example:

let mut opts = ServerOptions::new();
opts.pipe_mode(PipeMode::Message);
opts.reject_remote_clients(true);

sqlx: Binary Protocol Misinterpretation caused by Truncating or Overflowing Casts

RUSTSEC-2024-0363

The following presentation at this year's DEF CON was brought to our attention on the SQLx Discord:

SQL Injection isn't Dead: Smuggling Queries at the Protocol Level
http://web.archive.org/web/20240812130923/https://media.defcon.org/DEF%20CON%2032/DEF%20CON%2032%20presentations/DEF%20CON%2032%20-%20Paul%20Gerste%20-%20SQL%20Injection%20Isn't%20Dead%20Smuggling%20Queries%20at%20the%20Protocol%20Level.pdf
(Archive link for posterity.)

Essentially, encoding a value larger than 4GiB can cause the length prefix in the protocol to overflow, causing the server to interpret the rest of the string as binary protocol commands or other data.

It appears SQLx does perform truncating casts in a way that could be problematic, for example: https://github.com/launchbadge/sqlx/blob/6f2905695b9606b5f51b40ce10af63ac9e696bb8/sqlx-postgres/src/arguments.rs#L163

This code has existed essentially since the beginning, so it is reasonable to assume that all published versions <= 0.8.0 are affected.

Mitigation

As always, you should make sure your application is validating untrustworthy user input. Reject any input over 4 GiB, or any input that could encode to a string longer than 4 GiB. Dynamically built queries are also potentially problematic if it pushes the message size over this 4 GiB bound.

Encode::size_hint() can be used for sanity checks, but do not assume that the size returned is accurate. For example, the Json<T> and Text<T> adapters have no reasonable way to predict or estimate the final encoded size, so they just return size_of::<T>() instead.

For web application backends, consider adding some middleware that limits the size of request bodies by default.

Resolution

sqlx 0.8.1 has been released with the fix: https://github.com/launchbadge/sqlx/blob/main/CHANGELOG.md#081---2024-08-23

Postgres users are advised to upgrade ASAP as a possible exploit has been demonstrated: https://github.com/launchbadge/sqlx/issues/3440#issuecomment-2307956901

MySQL and SQLite do not appear to be exploitable, but upgrading is recommended nonetheless.