GHSA-q89g-4vhh-mvvm

Suggest an improvement
Source
https://github.com/advisories/GHSA-q89g-4vhh-mvvm
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/06/GHSA-q89g-4vhh-mvvm/GHSA-q89g-4vhh-mvvm.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-q89g-4vhh-mvvm
Aliases
Published
2022-06-17T00:16:48Z
Modified
2024-03-15T00:05:18.748750Z
Summary
Incorrect Lifetime Bounds on Closures in `rusqlite`
Details

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.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2022-06-17T00:16:48Z"
}
References

Affected packages

crates.io / rusqlite

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.26.0
Fixed
0.26.2

Ecosystem specific

{
    "affected_functions": [
        "rusqlite::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"
    ]
}

crates.io / rusqlite

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.25.0
Fixed
0.25.4

Ecosystem specific

{
    "affected_functions": [
        "rusqlite::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"
    ]
}