Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ GHSA-ff9q-rm55-q7qr — diesel-async

🟢 CVSS 2.0 — Low ✅ No Known Exploit CWE-126 OSV
2.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

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

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:

```rust

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:

```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:

```rust

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

How this vulnerability can be exploited

This issue can be reached with local access to the system, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. Rated impact: confidentiality low, integrity none, availability low.

CVSS metrics in full

The score comes from this vector: 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

  • Attack vector: Local — a local account, shell or session on the host is needed.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Attack requirements: None — no deployment-specific condition has to hold.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Confidentiality impact: Low — limited, and the attacker does not choose what is affected.
  • Integrity impact: None.
  • Availability impact: Low — limited, and the attacker does not choose what is affected.

Weakness class

GHSA-ff9q-rm55-q7qr is classified as CWE-126: Buffer Over-read. The product reads from a buffer using buffer access mechanisms such as indexes or pointers that reference memory locations after the targeted buffer.

Affected software

GHSA-ff9q-rm55-q7qr is recorded against 1 package.

  • diesel-async

Timeline and source

Published on 7 May 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.

References

github.com (Web)
github.com (Web)
github.com (Package)

Other advisories for this package

diesel-async has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-126: Buffer Over-read) in other software:

Details

Severity LOW
CVSS Score 2.0
CVSS Vector 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
CWE CWE-126
Public Exploit ✅ No
Source OSV
Published 2026-05-07
Updated 2026-08-20
Modified 2026-05-07
Fix URL N/A

Affected Packages

Software From version Fixed in
diesel-async — —

Similar Threats

Free Vulnerability Check

Is your site affected by GHSA-ff9q-rm55-q7qr?

BotEraser helps you identify potentially vulnerable plugins and themes by checking your installation against GHSA-ff9q-rm55-q7qr and other known CVE records.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesGitHub AdvisoryGitHub Advisory Undated
✓