CVE-2021-45718
JSON

7.5high

Use After Free in rusqlite

Severity
7.5high CVSS:3.1 by NVD
Exploit likelihood
1.22% (higher than 69% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-4qr3-m7ww-hh9gGHSA-87xh-9q6h-r5ccGHSA-92cx-4xm7-jr9mGHSA-cm8g-544f-p9x9GHSA-f6f2-3w33-54r9GHSA-g4g4-3pqw-8m7fGHSA-g87r-23vw-7f87GHSA-q89g-4vhh-mvvmRUSTSEC-2021-0128

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. rollback_hook has a use-after-free.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
rusqlite (crates.io)from 0.25.0 before 0.25.4, from 0.26.0 before 0.26.2, from 0.26.0-0 before 0.26.2GitHub Advisory Database, RustSec Advisory Database
rusqlite_project rusqlitefrom 0.25.0 before 0.25.4, from 0.26.0 before 0.26.2NVD

All scores

GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
GitHubhigh rating
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD5.0medium CVSS:2.0AV:N/AC:L/Au:N/C:N/I:N/A:P

Classification

What each source says

CVE List

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. rollback_hook has a use-after-free.

GitHub Advisory Database

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. commit_hook has a use-after-free.

GitHub Advisory Database

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. create_window_function has a use-after-free.

GitHub Advisory Database

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. create_scalar_function has a use-after-free.

GitHub Advisory Database

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. create_collation has a use-after-free.

GitHub Advisory Database

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. create_aggregate_function has a use-after-free.

GitHub Advisory Database

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.

GitHub Advisory Database

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.

NVD (es)

Se ha detectado un problema en la crate rusqlite versiones 0.25.x anteriores a 0.25.4 y versiones 0.26.x anteriores a 0.26.2 para Rust. La función rollback_hook presenta un uso de memoria previamente liberada

References

https://rustsec.org/advisories/RUSTSEC-2021-0128.htmladvisory, exploit, issue-tracking, third-party-advisory, web
https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/rusqlite/RUSTSEC-2021-0128.mdexploit, third-party-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2021-45717advisory
https://github.com/rusqlite/rusqlite/issues/1048report, web
https://github.com/rusqlite/rusqlitepackage, web
https://nvd.nist.gov/vuln/detail/CVE-2021-45715advisory
https://nvd.nist.gov/vuln/detail/CVE-2021-45713advisory
https://github.com/rusqlite/rusqlite/pull/1049web
https://github.com/rusqlite/rusqlite/commit/30f8c8c502675011603c4d066396bf317fd49e71web
https://github.com/rusqlite/rusqlite/commit/612158507e90f41d409cd0fa80eb21c992b1bc08web
https://github.com/rusqlite/rusqlite/commit/934e0c709e156753881da98b32e9853f9ffe4a1bweb
https://github.com/rusqlite/rusqlite/commit/f4f95f8caf9fd53bffd0c19530be2484c644cc16web

Related

Sources

SourceRecordLicence
CVE ListCVE-2021-45718 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-4qr3-m7ww-hh9g changed 2024-03-15CC-BY-4.0
GitHub Advisory DatabaseGHSA-87xh-9q6h-r5cc changed 2024-03-15CC-BY-4.0
GitHub Advisory DatabaseGHSA-92cx-4xm7-jr9m changed 2024-03-15CC-BY-4.0
GitHub Advisory DatabaseGHSA-cm8g-544f-p9x9 changed 2024-03-15CC-BY-4.0
GitHub Advisory DatabaseGHSA-f6f2-3w33-54r9 changed 2024-03-15CC-BY-4.0
GitHub Advisory DatabaseGHSA-g4g4-3pqw-8m7f changed 2024-03-15CC-BY-4.0
GitHub Advisory DatabaseGHSA-g87r-23vw-7f87 changed 2024-03-15CC-BY-4.0
GitHub Advisory DatabaseGHSA-q89g-4vhh-mvvm changed 2024-03-15CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2021-0128 changed 2024-03-15CC0-1.0
NVDCVE-2021-45718 changed 2026-06-17Public domain