Rust advisories / cassandra-cpp
Unsound HighRUSTSEC-2024-0017 · cassandra-cpp
RUSTSEC-2024-0017: Non-idiomatic use of iterators leads to use after free
Short answercassandra-cpp has an API that can cause undefined behaviour from safe code: Non-idiomatic use of iterators leads to use after free. Fixed in 3.0.0.
| Crate | cassandra-cpp |
|---|---|
| Type | Unsound (memory-corruption, memory-exposure) |
| Affected versions | Before 3.0.0. |
| Fixed in | 3.0.0 |
| Severity | High (GitHub rating) |
| Published | 2024-02-28 |
| Last changed | 2026-10-12 |
| Also known as | CVE-2024-27284, GHSA-x9xc-63hg-vcfq |
What to do
- See which version you have:
cargo tree -i cassandra-cpp(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p cassandra-cpp. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplecassandra-cpp = "3.0.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
Code that attempts to use an item (e.g., a row) returned by an iterator after the iterator has advanced to the next item will be accessing freed memory and experience undefined behaviour. Code that uses the item and then advances the iterator is unaffected. This problem has always existed.
This is a use-after-free bug, so it's rated high severity. If your code uses a pre-3.0.0 version of cassandra-rs, and uses an item returned by a cassandra-rs iterator after calling next() on that iterator, then it is vulnerable. However, such code will almost always fail immediately - so we believe it is unlikely that any code using this pattern would have reached production. For peace of mind, we recommend you upgrade anyway.
Patches
The problem has been fixed in version 3.0.0 (commit 299e6ac50f87eb2823a373baec37b590a74994ee). Users should upgrade to ensure their code cannot use the problematic pattern. There is an upgrade guide in the project README.
Workarounds
Ensure all usage fits the expected pattern. For example, use get_first_row() rather than an iterator, or completely process an item before advancing the iterator with next().
References
- Package: crates.io/crates/cassandra-cpp
- Advisory: rustsec.org/advisories/RUSTSEC-2024-0017.html
- Web: github.com/Metaswitch/cassandra-rs/commit/ae054dc8044eac9c2c7ae2b1ab154b53ca7f8df7
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?