Skip to content

fix(deps): update rust crate diesel-async to 0.9.0 [security] - #425

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/crate-diesel-async-vulnerability
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/crate-diesel-async-vulnerability

Conversation

@renovate

@renovate renovate Bot commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
diesel-async dependencies minor 0.7 → 0.9.0

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


diesel-async may expose uninitialized padding bytes for MySQL temporal columns

GHSA-ff9q-rm55-q7qr

More information

Details

Summary

diesel-async exposes uninitialized stack padding to safe code on every read of a MySQL DATE, TIME, DATETIME, or TIMESTAMP column. Reading that buffer is undefined behavior, and the leaked bytes can contain stale heap/stack contents, so this is both a soundness bug and a potential information-disclosure vector.

Details

In diesel-async/src/mysql/row.rs (lines 65-103), MysqlRow::get builds a MysqlTime from the parsed mysql_async::Value and then fabricates the byte buffer that downstream FromSql impls expect like this:

let date = MysqlTime::new(/* fields from Value::Date / Value::Time */);
let buffer = unsafe {
    let ptr = &date as *const MysqlTime as *const u8;
    let slice = std::slice::from_raw_parts(ptr, std::mem::size_of::<MysqlTime>());
    slice.to_vec()
};

MysqlTime is #[repr(C)] with 3 bytes of padding after bool neg (Linux x86_64, offsets 0x21..0x23). The literal construction leaves that padding uninitialized, and to_vec() carries it into a Vec<u8> that becomes the MysqlValue's backing buffer, reachable from safe code via MysqlValue::as_bytes() -> &[u8].

diesel itself avoids this by going through MaybeUninit::<MysqlTime>::zeroed() + ptr::copy_nonoverlapping (see diesel/src/mysql/value.rs:43-94); the same pattern would fix this. Alternatively, write the bytes diesel's FromSql reads without round-tripping through a MysqlTime value.

PoC

Cargo.toml:

[dependencies]
diesel = { version = "~2.3.0", default-features = false, features = ["mysql_backend"] }
diesel-async = { version = "=0.8.0", features = ["mysql"] }
mysql_common = { version = "0.35", default-features = false }

src/main.rs:

use diesel::row::{Field, Row};
use diesel_async::{AsyncConnectionCore, AsyncMysqlConnection};
use mysql_common::{constants::ColumnType, packets::Column, prelude::FromRow, value::Value};

type MysqlRow = <AsyncMysqlConnection as AsyncConnectionCore>::Row<'static, 'static>;

fn main() {
    let cols = std::sync::Arc::from([Column::new(ColumnType::MYSQL_TYPE_DATE)]);
    let raw = mysql_common::row::new_row(vec![Value::Date(2024, 1, 1, 0, 0, 0, 0)], cols);
    let row: MysqlRow = FromRow::from_row(raw);

    let field = row.get(0).unwrap();
    let bytes = field.value().unwrap().as_bytes();
    let _: u64 = bytes.iter().map(|&b| b as u64).sum(); // UB: hits padding
}

Miri output:

error: Undefined Behavior: reading memory at alloc844[0x21..0x22], but memory is uninitialized at [0x21..0x22], and this operation requires initialized memory
  --> src/main.rs:14:37
   |
14 |     let _: u64 = bytes.iter().map(|&b| b as u64).sum(); // UB: hits padding
   |                                     ^ Undefined Behavior occurred here
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
   = note: stack backtrace:
           0: main::{closure#0}
               at src/main.rs:14:37: 14:38
           1: std::iter::adapters::map::map_fold::<&u8, u64, u64, {closure@src/main.rs:14:35: 14:39}, {closure@<u64 as std::iter::Sum>::sum<std::iter::Map<std::slice::Iter<'_, u8>, {closure@src/main.rs:14:35: 14:39}>>::{closure#0}}>::{closure#0}
               at /home/paolobarbolini/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:88:28: 88:34
           2: <std::slice::Iter<'_, u8> as std::iter::Iterator>::fold::<u64, {closure@std::iter::adapters::map::map_fold<&u8, u64, u64, {closure@src/main.rs:14:35: 14:39}, {closure@<u64 as std::iter::Sum>::sum<std::iter::Map<std::slice::Iter<'_, u8>, {closure@src/main.rs:14:35: 14:39}>>::{closure#0}}>::{closure#0}}>
               at /home/paolobarbolini/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:279:27: 279:85
           3: <std::iter::Map<std::slice::Iter<'_, u8>, {closure@src/main.rs:14:35: 14:39}> as std::iter::Iterator>::fold::<u64, {closure@<u64 as std::iter::Sum>::sum<std::iter::Map<std::slice::Iter<'_, u8>, {closure@src/main.rs:14:35: 14:39}>>::{closure#0}}>
               at /home/paolobarbolini/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:128:9: 128:50
           4: <u64 as std::iter::Sum>::sum::<std::iter::Map<std::slice::Iter<'_, u8>, {closure@src/main.rs:14:35: 14:39}>>
               at /home/paolobarbolini/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/accum.rs:52:17: 56:18
           5: <std::iter::Map<std::slice::Iter<'_, u8>, {closure@src/main.rs:14:35: 14:39}> as std::iter::Iterator>::sum::<u64>
               at /home/paolobarbolini/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:3676:9: 3676:23
           6: main
               at src/main.rs:14:18: 14:55

Uninitialized memory occurred at alloc844[0x21..0x22], in this allocation:
alloc844 (Rust heap, size: 48, align: 1) {
    0x00 │ e8 07 00 00 01 00 00 00 01 00 00 00 00 00 00 00 │ ................
    0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
    0x20 │ 00 __ __ __ 01 00 00 00 00 00 00 00 __ __ __ __ │ .░░░........░░░░
}
Impact

Soundness bug in safe API surface of diesel-async's MySQL backend. Affects every user of AsyncMysqlConnection whose queries return a temporal column.

AI disclosure: this issue was found via Claude Code running Claude Opus 4.7.

Severity

  • CVSS Score: 2.0 / 10 (Low)
  • Vector String: CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

weiznich/diesel_async (diesel-async)

v0.9.0

Compare Source

  • Change all transaction related functions to accept an real async closure instead of
    the scoped boxed variant. This change requires adujsting all call sides of transaction
    based functions from conn.transaction(|conn| async move {/* your code */}.scoped_boxed())
    to conn.transaction(async |conn| /* your code */)
  • Fixed an unsound access to padding values while deserializing Date/Time values in the mysql backend
    Thanks to Paolo Barbolini for finding this issue.

v0.8.0

Compare Source

  • Added support for UpdateAndFetchResults for SyncConnectionWrapper, allowing to use save_changes
  • Bumped supported deadpool version to 0.13
  • Fixed a bug with postgres query pipelining that can cause panics
  • Fixed a bug with the SyncConnectionWrapper that can cause panics if the future is dropped before completion

v0.7.4

Compare Source

  • Fixed an issue with dropping uncached mysql statements

v0.7.3

Compare Source

  • Another docs.rs build fix

v0.7.2

Compare Source

  • Fix versions in the Readme

v0.7.1

Compare Source

  • Fix the docs.rs build

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] May 12, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 76bc20c to a969765 Compare May 12, 2026 17:38
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] May 12, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch 2 times, most recently from 7e6e224 to 625daad Compare May 14, 2026 17:51
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] May 14, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 625daad to ac0e3b1 Compare May 14, 2026 20:37
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] May 14, 2026
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] May 18, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch 2 times, most recently from 08bcfef to 3164813 Compare May 19, 2026 00:46
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] May 19, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 3164813 to dddc670 Compare May 22, 2026 21:07
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] May 22, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from dddc670 to b8b538f Compare May 23, 2026 01:48
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] May 23, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from b8b538f to 4737ff5 Compare May 28, 2026 16:39
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] May 28, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 4737ff5 to 9fa1382 Compare May 29, 2026 00:10
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] May 29, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 9fa1382 to 4ff3e9d Compare June 1, 2026 22:47
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Jun 1, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 4ff3e9d to 9b3776e Compare June 2, 2026 02:52
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Jun 2, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 9b3776e to 6e4c8c8 Compare June 11, 2026 21:12
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Jun 11, 2026
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Jun 12, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 6e4c8c8 to cb922c7 Compare June 12, 2026 03:04
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Jun 18, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from cb922c7 to 30a87ca Compare June 18, 2026 19:09
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Jul 21, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 63fb508 to af386a7 Compare July 21, 2026 08:14
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Jul 21, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from af386a7 to 66bf0dc Compare July 22, 2026 12:02
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Jul 22, 2026
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Jul 22, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch 2 times, most recently from 2ed706e to 5b14c49 Compare July 24, 2026 14:45
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Jul 24, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 5b14c49 to 7239c55 Compare July 24, 2026 21:39
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Jul 24, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 7239c55 to d265b3c Compare July 30, 2026 18:06
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Jul 30, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from d265b3c to de77f40 Compare July 30, 2026 22:56
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Jul 30, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from de77f40 to 6aa6fca Compare August 11, 2026 22:32
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Aug 11, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 6aa6fca to f22272f Compare August 12, 2026 05:31
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Aug 12, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from f22272f to 90c02e9 Compare August 14, 2026 17:36
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Aug 14, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 90c02e9 to f86c5d0 Compare August 15, 2026 00:08
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Aug 15, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from f86c5d0 to 84f09f0 Compare August 18, 2026 17:49
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Aug 18, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from 84f09f0 to a1f72eb Compare August 18, 2026 22:00
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9 [security] fix(deps): update rust crate diesel-async to 0.9.0 [security] Aug 18, 2026
@renovate
renovate Bot force-pushed the renovate/crate-diesel-async-vulnerability branch from a1f72eb to 0d4723f Compare August 20, 2026 14:56
@renovate renovate Bot changed the title fix(deps): update rust crate diesel-async to 0.9.0 [security] fix(deps): update rust crate diesel-async to 0.9 [security] Aug 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants