GHSA-h5x4-m2qf-r4f2: Diesel Diesel's SQLite Backend Has Possible Vulnerability
HIGHGHSA-h5x4-m2qf-r4f2 is a HIGH diesel's sqlite backend has possible vulnerability (CWE-20: Improper Input Validation) affecting Diesel libraries in the crates.io ecosystem. The issue involves diesel's sqlite backend has possible utf-8 corruption. Remediation is available by upgrading affected packages to version 2.3.8.
GHSA-h5x4-m2qf-r4f2 at a Glance
How to Fix GHSA-h5x4-m2qf-r4f2
To remediate this vulnerability, upgrade all affected Diesel dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade diesel to 2.3.8
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for diesel
How to Check if You Are Affected
To determine whether your application is affected by GHSA-h5x4-m2qf-r4f2, inspect your project dependencies for Diesel:
inspect dependencies for diesel
Analyze the terminal output to locate any version of Diesel in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.3.8), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Diesel, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-h5x4-m2qf-r4f2 Affected Diesel Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
diesel
|
crates.io |
< 2.3.8
|
2.3.8
|
References
Frequently Asked Questions
What is GHSA-h5x4-m2qf-r4f2?
Which Diesel versions are affected?
What version fixes GHSA-h5x4-m2qf-r4f2?
Is diesel affected?
What CWE is associated with GHSA-h5x4-m2qf-r4f2?
How can I check crates.io dependencies for GHSA-h5x4-m2qf-r4f2?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-h5x4-m2qf-r4f2",
"modified" : "2026-05-05T18:08:05Z",
"published" : "2026-05-05T18:08:05Z",
"aliases" : [ ],
"summary" : "Diesel's SQLite backend has possible UTF-8 corruption",
"details" : "Diesel uses the `sqlite3_value_text` function to receive strings from SQLite while deserializing query results. We misinterpreted the corresponding [SQLite](https://sqlite.org/c3ref/value_blob.html) documentation that this function always returns a UTF-8 encoded string values as `*const c_char`. Based on that we used `str::from_utf8_unchecked` to construct a Rust string slice without any additional UTF-8 checks in place. It turned out that this function doesn't always return correct UTF-8 strings. For field of the SQLite side storage type `BLOB` this pointer can contain arbitrary bytes, which makes the usage of `str::from_utf8_unchecked` unsound as this violates the safety contract of `str` to only contain valid UTF-8 encoded Strings.\n\n## Mitigation\n\nThe preferred mitigation to the outlined problem is to update to a Diesel version 2.3.8 or newer, which includes fixes for the problem.\n\n## Resolution\n\nDiesel now correctly checks whether the provides byte buffer is actually valid UTF-8, instead of relying on SQLite's documentation. This fix is included in the `2.3.8` release.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "diesel"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.3.8"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/diesel-rs/diesel/pull/5042"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/diesel-rs/diesel"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2026-0111.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-05T18:08:05Z",
"nvd_published_at" : null
}
}