Email me

Rust advisories / diesel

Vulnerability CriticalRUSTSEC-2021-0037 · diesel

RUSTSEC-2021-0037: Fix a use-after-free bug in diesels Sqlite backend

Short answerA security vulnerability in the diesel crate: Fix a use-after-free bug in diesels Sqlite backend. Critical severity (CVSS 9.8). Fixed in 1.4.6: update to a fixed version.

Cratediesel
TypeVulnerability (memory-corruption)
Affected versionsBefore 1.4.6.
Fixed in1.4.6
SeverityCritical, CVSS 9.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Published2021-03-05
Last changed2023-11-08
Also known asCVE-2021-28305, GHSA-j8q9-5rp9-4mv9
Affected functionsdiesel::SqliteConnection::query_by_name

What to do

  1. See which version you have: cargo tree -i diesel (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p diesel. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example diesel = "1.4.6") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

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.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for diesel

Full security history of diesel

Up next

Same cratediesel: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ