{"id":"CVE-2021-28305","aliases":["DEBIAN-CVE-2021-28305","EUVD-2022-4315","GHSA-j8q9-5rp9-4mv9","RUSTSEC-2021-0037"],"status":"published","title":"Fix a use-after-free bug in diesels Sqlite backend","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.","severity":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-11","score":0.01319,"percentile":0.7121,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-416"],"published":"2021-03-05T12:00:00Z","modified":"2026-10-23T18:03:37Z","fixes":[{"ecosystem":"crates.io","package":"diesel","fixed_in":["1.4.6"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:13","package":"rust-diesel","fixed_in":["2.0.3-1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"rust-diesel","fixed_in":["2.0.3-1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"diesel","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.4.6"}]}]},{"source":"osv","ecosystem":"Debian:13","package":"rust-diesel","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.0.3-1"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"rust-diesel","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.0.3-1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"diesel","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.4.6"}]}]},{"source":"osv","ecosystem":"crates.io","package":"diesel","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"1.4.6"}]}]}],"products":[{"vendor":"diesel","product":"diesel"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0037.html","tags":["x_refsource_MISC","x_transferred","Third Party Advisory","advisory","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28305","tags":["advisory"]},{"url":"https://github.com/diesel-rs/diesel/pull/2663","tags":["web"]},{"url":"https://github.com/advisories/GHSA-j8q9-5rp9-4mv9"},{"url":"https://security-tracker.debian.org/tracker/CVE-2021-28305","tags":["advisory"]},{"url":"https://github.com/diesel-rs/diesel","tags":["package"]},{"url":"https://crates.io/crates/diesel","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2021-28305","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.","status":"published","published":"2021-03-12T08:15:58Z","modified":"2024-08-03T21:40:13.963Z","updated_at":"2026-11-02T14:33:08.811269Z"}],"euvd":[{"id":"EUVD-2022-4315","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.","status":"published","published":"2021-03-12T08:15:58Z","modified":"2024-08-03T21:40:13Z","updated_at":"2026-11-03T03:24:47.350261Z"}],"ghsa":[{"id":"GHSA-j8q9-5rp9-4mv9","title":"Fix a use-after-free bug in diesels Sqlite backend","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.","status":"published","published":"2022-05-24T17:44:31Z","modified":"2023-01-27T05:02:43Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-416"],"updated_at":"2026-11-02T14:36:19.144959Z"}],"nvd":[{"id":"CVE-2021-28305","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.","status":"published","published":"2021-03-12T09:15:12.783Z","modified":"2026-06-17T03:46:07.997Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary"},{"version":"2.0","score":7.5,"vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","level":"high","assessor":"primary"}],"cwes":["CWE-416"],"updated_at":"2026-11-02T14:06:50.805771Z"}],"osv":[{"id":"CVE-2021-28305","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.","status":"published","published":"2021-03-12T09:15:12.783Z","modified":"2026-03-14T08:23:50.687627Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T15:44:19.129331Z"},{"id":"DEBIAN-CVE-2021-28305","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.","status":"published","published":"2021-03-12T09:15:12.783Z","modified":"2026-10-23T18:03:37.602552868Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T15:45:34.94143Z"},{"id":"GHSA-j8q9-5rp9-4mv9","title":"Fix a use-after-free bug in diesels Sqlite backend","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.","status":"published","published":"2022-05-24T17:44:31Z","modified":"2023-11-08T04:05:29.499484Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-416"],"updated_at":"2026-11-02T15:46:50.336262Z"},{"id":"RUSTSEC-2021-0037","title":"Fix a use-after-free bug in diesels Sqlite backend","description":"We've misused `sqlite3_column_name`. The\n[SQLite](https://www.sqlite.org/c3ref/column_name.html) documentation\nstates that the following:\n\n\u003e The returned string pointer is valid until either the prepared statement\n\u003e is destroyed by sqlite3_finalize() or until the statement is automatically\n\u003e reprepared by the first call to sqlite3_step() for a particular\n\u003e run or until the next call to sqlite3_column_name()\n\u003e 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.","status":"published","published":"2021-03-05T12:00:00Z","modified":"2023-11-08T04:05:29.499484Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T15:53:39.492624Z"}]}}
