VYPR
High severityNVD Advisory· Published Dec 26, 2021· Updated Aug 4, 2024

CVE-2021-45719

CVE-2021-45719

Description

An issue was discovered in the rusqlite crate 0.25.x before 0.25.4 and 0.26.x before 0.26.2 for Rust. update_hook has a use-after-free.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Use-after-free in rusqlite's update_hook due to incorrect lifetime bounds on closures, affecting versions 0.25.x before 0.25.4 and 0.26.x before 0.26.2.

Vulnerability

In the rusqlite crate for Rust, the update_hook function (under cfg(feature = "hooks")) registered a callback with an overly relaxed lifetime bound [2][4]. This allowed a closure that borrows stack-local data to be passed to update_hook, even though the closure could be invoked later by SQLite after the borrowed values have been dropped, leading to a use-after-free. The vulnerability affects versions 0.25.0 through 0.25.3 and 0.26.0 through 0.26.1 [2][4].

Exploitation

An attacker must provide a closure to update_hook that captures references to data on the stack, and then arrange for that stack data to go out of scope before the closure is called by SQLite [2][4]. This can occur when the closure is created in a function scope and the callback is invoked after the function returns [4]. The attacker does not need special network access or authentication; the exploitation depends on the program's control flow and the ability to trigger a database transaction that invokes the hook after the borrowed data is freed [2][4].

Impact

Successful exploitation results in a use-after-free memory corruption, which can lead to information disclosure, arbitrary code execution, or a program crash [2][4]. Since rusqlite is a low-level binding, the impact could be severe if the attacker controls the freed memory content [2].

Mitigation

Upgrade to rusqlite version 0.25.4 or 0.26.2, where the lifetime bounds were corrected [2][4]. If an immediate upgrade is not possible, avoid passing closures that borrow stack-local data to update_hook, and ensure that any captured data has a lifetime at least as long as the database connection [4]. No workaround exists that fully addresses the root cause without patching [2].

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
rusqlitecrates.io
>= 0.25.0, < 0.25.40.25.4
rusqlitecrates.io
>= 0.26.0, < 0.26.20.26.2

Affected products

2

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

5

News mentions

0

No linked articles in our index yet.