9.8critical
Fix a use-after-free bug in diesels Sqlite backend
- Severity
- 9.8critical CVSS:3.1 by NVD
- Exploit likelihood
- 1.32% (higher than 71% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-j8q9-5rp9-4mv9RUSTSEC-2021-0037
Description
An issue was discovered in the diesel crate before 1.4.6 for Rust. There is a use-after-free in the SQLite backend because the semantics of sqlite3_column_name are not followed.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| diesel (crates.io) | before 1.4.6, from 0.0.0-0 before 1.4.6 | GitHub Advisory Database, RustSec Advisory Database |
| diesel diesel | before 1.4.6 | NVD |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| RustSec Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.5high CVSS:2.0 | AV:N/AC:L/Au:N/C:P/I:P/A:P |
Classification
What each source says
CVE List
An issue was discovered in the diesel crate before 1.4.6 for Rust. There is a use-after-free in the SQLite backend because the semantics of sqlite3_column_name are not followed.
RustSec Advisory Database
We've misused sqlite3_column_name. The
SQLite documentation
states that the following:
The returned string pointer is valid until either the prepared statement is destroyed by sqlite3_finalize() or until the statement is automatically reprepared by the first call to sqlite3_step() for a particular run or until the next call to sqlite3_column_name() or sqlite3_column_name16() on the same column.
As part of our query_by_name infrastructure we've first received all
field names for the prepared statement and stored them as string slices
for later use. After that we called sqlite3_step() for the first time,
which invalids the pointer and therefore the stored string slice.
NVD (es)
Se detectó un problema en la crate diesel versiones anteriores a 1.4.6 para Rust. Se presenta un uso de la memoria previamente liberada en el backend de SQLite porque no se sigue la semántica de la función sqlite3_column_name
References
| https://rustsec.org/advisories/RUSTSEC-2021-0037.html | advisory, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-28305 | advisory | |
| https://github.com/diesel-rs/diesel/pull/2663 | web | |
| https://github.com/diesel-rs/diesel | package | |
| https://crates.io/crates/diesel | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-28305 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-j8q9-5rp9-4mv9 changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0037 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-28305 changed 2026-06-17 | Public domain |