RUSTSEC-2021-0128 (CVE-2021-45713)

Vulnerability from osv_rustsec – Published: 2021-12-07 12:00 – Updated: 2023-06-13 13:10 – Source website
VLAI
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.

Impacted products
Ecosystem Package Version
crates.io rusqlite
pkg:cargo/rusqlite
Affected: ≥ 0.25.0, < 0.25.4, ≥ 0.26.0-0, < 0.26.2 (semver)

{
  "affected": [
    {
      "database_specific": {
        "categories": [
          "memory-corruption"
        ],
        "cvss": null,
        "informational": null
      },
      "ecosystem_specific": {
        "affected_functions": null,
        "affects": {
          "arch": [],
          "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"
          ],
          "os": []
        }
      },
      "package": {
        "ecosystem": "crates.io",
        "name": "rusqlite",
        "purl": "pkg:cargo/rusqlite"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0.25.0"
            },
            {
              "fixed": "0.25.4"
            },
            {
              "introduced": "0.26.0-0"
            },
            {
              "fixed": "0.26.2"
            }
          ],
          "type": "SEMVER"
        }
      ],
      "versions": []
    }
  ],
  "aliases": [
    "CVE-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"
  ],
  "database_specific": {
    "license": "CC0-1.0"
  },
  "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.",
  "id": "RUSTSEC-2021-0128",
  "modified": "2023-06-13T13:10:24Z",
  "published": "2021-12-07T12:00:00Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://crates.io/crates/rusqlite"
    },
    {
      "type": "ADVISORY",
      "url": "https://rustsec.org/advisories/RUSTSEC-2021-0128.html"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/rusqlite/rusqlite/issues/1048"
    }
  ],
  "related": [],
  "severity": [],
  "summary": "Incorrect Lifetime Bounds on Closures in `rusqlite`"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.