GHSA-q89g-4vhh-mvvm: Rusqlite Incorrect Lifetime Bounds On Closures Vulnerability

HIGH
Published
Advisory Summary

GHSA-q89g-4vhh-mvvm is a HIGH incorrect lifetime bounds on closures vulnerability (General Security Weakness) affecting Rusqlite libraries in the crates.io ecosystem. The issue involves incorrect lifetime bounds on closures in `rusqlite`. Remediation is available by upgrading affected packages to version 0.26.2, 0.25.4.

GHSA-q89g-4vhh-mvvm at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-q89g-4vhh-mvvm
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Rusqlite
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-q89g-4vhh-mvvm

To remediate this vulnerability, upgrade all affected Rusqlite dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rusqlite fixed: 0.26.2
Upgrade rusqlite to 0.26.2
rusqlite fixed: 0.25.4
Upgrade rusqlite to 0.25.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for rusqlite

How to Check if You Are Affected

To determine whether your application is affected by GHSA-q89g-4vhh-mvvm, inspect your project dependencies for Rusqlite:

inspect dependencies for rusqlite

Analyze the terminal output to locate any version of Rusqlite in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.26.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Rusqlite, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

GHSA-q89g-4vhh-mvvm Affected Rusqlite Versions

2 component(s)
Fixed Versions:
0.26.20.25.4
Product / Package Ecosystem Affected Versions Fixed Version
rusqlite
crates.io
≥ 0.26.0
< 0.26.2
0.26.2
rusqlite
crates.io
≥ 0.25.0
< 0.25.4
0.25.4

References

Frequently Asked Questions

What is GHSA-q89g-4vhh-mvvm?
GHSA-q89g-4vhh-mvvm is a security vulnerability in Rusqlite involving Incorrect Lifetime Bounds on Closures in `rusqlite` under General Security Weakness.
Which Rusqlite versions are affected?
Affected versions include releases prior to 0.26.2, 0.25.4 across affected packages: rusqlite.
What version fixes GHSA-q89g-4vhh-mvvm?
Upgrading to 0.26.2, 0.25.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rusqlite affected?
Yes, rusqlite is affected in releases prior to 0.26.2, 0.25.4. Upgrade your dependency to 0.26.2, 0.25.4 or later.
What CWE is associated with GHSA-q89g-4vhh-mvvm?
GHSA-q89g-4vhh-mvvm is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-q89g-4vhh-mvvm?
Run the dependency tree command: 'inspect dependencies for rusqlite'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-q89g-4vhh-mvvm",
  "modified" : "2022-06-17T00:16:48Z",
  "published" : "2022-06-17T00:16:48Z",
  "aliases" : [ ],
  "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.\n\nThe impacted functions are:\n\n- Under `cfg(feature = \"functions\")`: `Connection::create_scalar_function`, `Connection::create_aggregate_function` and `Connection::create_window_function`.\n- Under `cfg(feature = \"hooks\")`: `Connection::commit_hook`, `Connection::rollback_hook` and `Connection::update_hook`.\n- Under `cfg(feature = \"collation\")`: `Connection::create_collation`.\n\nThe 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`).\n\nThe 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.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "rusqlite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.26.0"
      }, {
        "fixed" : "0.26.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "rusqlite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.25.0"
      }, {
        "fixed" : "0.25.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rusqlite/rusqlite/issues/1048"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rusqlite/rusqlite"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2021-0128.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T00:16:48Z",
    "nvd_published_at" : null
  }
}