Email me

Rust advisories / rusqlite

Vulnerability HighRUSTSEC-2021-0128 · rusqlite

RUSTSEC-2021-0128: Incorrect Lifetime Bounds on Closures in `rusqlite`

Short answerA security vulnerability in the rusqlite crate: Incorrect Lifetime Bounds on Closures in `rusqlite`. GitHub rates it High. Fixed in 0.25.4, 0.26.2: update to a fixed version.

Craterusqlite
TypeVulnerability (memory-corruption)
Affected versionsFrom 0.25.0 before 0.25.4; from 0.26.0 before 0.26.2.
Fixed in0.25.4, 0.26.2
SeverityHigh (GitHub rating)
Published2021-12-07
Last changed2024-03-15
Also known asCVE-2021-45713, CVE-2021-45714, CVE-2021-45715, CVE-2021-45716, CVE-2021-45717, CVE-2021-45718, CVE-2021-45719, GHSA-4qr3-m7ww-hh9g, GHSA-87xh-9q6h-r5cc, GHSA-92cx-4xm7-jr9m, GHSA-cm8g-544f-p9x9, GHSA-f6f2-3w33-54r9, GHSA-g4g4-3pqw-8m7f, GHSA-g87r-23vw-7f87, GHSA-q89g-4vhh-mvvm
Affected functionsrusqlite::Connection::commit_hook, rusqlite::Connection::create_aggregate_function, rusqlite::Connection::create_collation, rusqlite::Connection::create_scalar_function, rusqlite::Connection::create_window_function, rusqlite::Connection::rollback_hook, rusqlite::Connection::update_hook

What to do

  1. See which version you have: cargo tree -i rusqlite (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p rusqlite. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example rusqlite = "0.26.2") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

The lifetime bound on several closure-accepting rusqlite functions (specifically, functions which register a callback to be later invoked by SQLite) was too relaxed. If a closure referencing borrowed values on the stack is was passed to one of these functions, it could allow Rust code to access objects on the stack after they have been dropped.

The impacted functions are:

  • Under cfg(feature = "functions"): Connection::create_scalar_function, Connection::create_aggregate_function and Connection::create_window_function.
  • Under cfg(feature = "hooks"): Connection::commit_hook, Connection::rollback_hook and Connection::update_hook.
  • Under cfg(feature = "collation"): Connection::create_collation.

The issue exists in all 0.25.* versions prior to 0.25.4, and all 0.26.* versions prior to 0.26.2 (specifically: 0.25.0, 0.25.1, 0.25.2, 0.25.3, 0.26.0, and 0.26.1).

The fix is available in versions 0.26.2 and newer, and also has been back-ported to 0.25.4. As it does not exist in 0.24.*, all affected versions should have an upgrade path to a semver-compatible release.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for rusqlite

Full security history of rusqlite

Up next

Same craterusqlite: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ