Skip to content

RUSTSEC-2026-0134

Unsound access to padding bytes while serializing date/time values using the Mysql backend

Not rated yet crates.io
Severity
Not rated yet
No source has published a CVSS score yet
Exploit chance (EPSS)
—
No score published
Known exploited
No
Not in CISA's catalog
Weakness
—
Not classified
Fix
2.3.8
Upgrade diesel to this version or later

Description

Diesel relies on libmysqlclient for interacting with Mysql compatible databases. This library requires to provide date/time values according to the byte layout of their MYSQL_TIME type.

Diesel replicated this type as #[repr(C)] struct, populated all the fields of this struct and then casted this value to an array of bytes. As this cast exposes padding bytes contained in this struct, this is undefined behaviour.

This vulnerability affects any user serializing date/time values using the Mysql backend.

Mitigation

The preferred mitigation to the outlined problem is to update to Diesel version 2.3.8 or newer, which includes fixes for the problem.

Resolution

Diesel now manually serializes the relevant data without accessing the padding bytes.

Affected versions

crates.io

PackageVulnerableFixed in
diesel
>= 0.0.0-0, < 2.3.8
2.3.8

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

diesel crates.io → 2.3.8

cargo
cargo update -p diesel --precise 2.3.8

References

Timeline

  1. Published
  2. Last updated by the source
AdvisorySeverityWhy it's related
GHSA-ggxf-9f6j-w742
Diesel has possible use after free when deserializing a SQLite database via `SqliteConnection::deserialize_readonly_database`
Medium Also affects diesel
RUSTSEC-2026-0135
Unsound transmute while debug/display printing batch Insert statements in Diesel's SQLite backend
Not rated yet Also affects diesel
GHSA-m9p2-fxp5-v3fp
Diesel: Command injection in Diesel's implementation of `COPY FROM`/`COPY TO`
Medium Also affects diesel
GHSA-q8x8-jrhj-fh9p
Diesel: Possible unaligned data access for implementations of `SqliteAggregate`
Medium Also affects diesel
GHSA-h5x4-m2qf-r4f2
Diesel's SQLite backend has possible UTF-8 corruption
High Also affects diesel
GHSA-wq9x-qwcq-mmgf
Diesel vulnerable to Binary Protocol Misinterpretation caused by Truncating or Overflowing Casts
High Also affects diesel
RUSTSEC-2021-0037
Fix a use-after-free bug in diesels Sqlite backend
Critical Also affects diesel
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor