Executive brief
Diesel, a popular database toolkit for the Rust programming language, contains a memory safety flaw when loading SQLite databases from memory. An application using this specific feature could crash or behave unpredictably if the memory buffer containing the database is cleared while the connection is still active. This could lead to service instability or potential data corruption in affected applications.
Technical details
A use-after-free vulnerability exists in Diesel's SQLite backend due to improper lifetime management of memory buffers. When using `SqliteConnection::deserialize_readonly_database`, Diesel passed a byte slice (`&[u8]`) directly to `libsqlite3` without ensuring the buffer's lifetime matched the connection's lifetime. If a caller drops the buffer while the connection remains open, `libsqlite3` may attempt to access freed memory. This is reachable if an attacker can influence the data or timing of database deserialization in an application. The issue is resolved in version 2.3.10 by having `SqliteConnection` take ownership of a copy of the buffer.
Affected products
- diesel-rs diesel < 2.3.10
Timeline
- 2026-06-05: disclosed: Reported via RustSec
- 2026-07-16: advisory: GitHub Advisory published
- 2026-07-16: patched: Version 2.3.10 released