{"id":"CVE-2021-28305","aliases":["CVE-2021-28305","GHSA-j8q9-5rp9-4mv9","RUSTSEC-2021-0037"],"related":[],"kind":"vulnerability","state":"published","title":"Fix a use-after-free bug in diesels Sqlite backend","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"We've misused `sqlite3_column_name`. The\n[SQLite](https://www.sqlite.org/c3ref/column_name.html) documentation\nstates that the following:\n\n> The returned string pointer is valid until either the prepared statement\n> is destroyed by sqlite3_finalize() or until the statement is automatically\n> reprepared by the first call to sqlite3_step() for a particular\n> run or until the next call to sqlite3_column_name()\n> or sqlite3_column_name16() on the same column.\n\nAs part of our `query_by_name` infrastructure we've first received all\nfield names for the prepared statement and stored them as string slices\nfor later use. After that we called `sqlite3_step()` for the first time,\nwhich invalids the pointer and therefore the stored string slice.","format":"markdown","source":"rustsec"},{"lang":"es","text":"Se detectó un problema en la crate diesel versiones anteriores a 1.4.6 para Rust.&#xa0;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","source":"nvd"}],"published":"2021-03-05T12:00:00.000Z","modified":"2026-06-17T03:46:07.997Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","score":7.5,"rating":"HIGH"}],"cwes":["CWE-416"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.4.6"}],"ecosystem":"crates.io","package":"diesel","purl":"pkg:cargo/diesel","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"1.4.6"}],"ecosystem":"crates.io","package":"diesel","purl":"pkg:cargo/diesel","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"1.4.6"}],"vendor":"diesel","product":"diesel","cpe":"cpe:2.3:a:diesel:diesel:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0037.html","tags":["advisory","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28305","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/diesel-rs/diesel/pull/2663","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/diesel-rs/diesel","tags":["package"],"sources":["ghsa"]},{"url":"https://crates.io/crates/diesel","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-28305","url":"https://www.cve.org/CVERecord?id=CVE-2021-28305","licence":"CVE Terms of Use","modified":"2024-08-03T21:40:13.963Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j8q9-5rp9-4mv9","url":"https://github.com/advisories/GHSA-j8q9-5rp9-4mv9","licence":"CC-BY-4.0","modified":"2023-11-08T04:05:29.499Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2021-0037","url":"https://rustsec.org/advisories/RUSTSEC-2021-0037.html","licence":"CC0-1.0","modified":"2023-11-08T04:05:29.499Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-28305","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28305","licence":"Public domain","modified":"2026-06-17T03:46:07.997Z"}],"updatedAt":"2026-11-25T22:58:00.272Z","epss":{"score":0.01319,"percentile":0.7167,"date":"2026-12-01T12:00:22.000Z"}}