# GHSA-ggxf-9f6j-w742: Diesel allows loading a SQLite database from a byte buffer, represented as `&[u8]`, at runtime via the `SqliteConnection::deserialize_readon

> Attackers can trigger use-after-free in Diesel SQLite deserialization if buffers are dropped early, potentially causing crashes or code execution.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 5 Jun 2026
- **Also known as:** RUSTSEC-2026-0172

## What is GHSA-ggxf-9f6j-w742?

GHSA-ggxf-9f6j-w742 is an use after free vulnerability in diesel, published on 5 Jun 2026. 

### Official description

Diesel allows loading a SQLite database from a byte buffer, represented as `&[u8]`, at runtime via the `SqliteConnection::deserialize_readonly_database` function. In previous versions of Diesel, this buffer was passed directly to libsqlite3. Since libsqlite3 requires the buffer to remain alive for as long as the database connection is open and Diesel did not ensure this as part of its safe API, callers of `SqliteConnection::deserialize_readonly_database` could drop the buffer prematurely. This prematurely drop caused libsqlite3 to operate on freed memory.

This vulnerability affects users of `SqliteConnection::deserialize_readonly_database` who drop the buffer passed to the function before they drop the database connection.

## Mitigation

The preferred mitigation to the outlined problem is to update to Diesel version 2.3.10 or newer, which includes a fix for the problem. Alternatively users need to take to keep the buffer alive until the connection is dropped.

## Resolution

Diesel now stores a copy of the buffer inside of the `SqliteConnection` object itself to keep it alive as long as the underlying libsqlite3 connection exists.

## Which versions are affected by GHSA-ggxf-9f6j-w742?

3 open source packages ship an affected version, including diesel.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `diesel` | crates.io | All versions | 2.3.10 |
| `diesel` | crates.io | All versions | 2.3.10 |
| `diesel` | crates.io | From 0.0.0-0 | 2.3.10 |

## How do I fix GHSA-ggxf-9f6j-w742?

Upgrade diesel to 2.3.10 or later.

## Is GHSA-ggxf-9f6j-w742 being exploited?

There is no known exploitation of GHSA-ggxf-9f6j-w742 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-ggxf-9f6j-w742 and fix it if it is affected.

What it is: GHSA-ggxf-9f6j-w742 is an use after free vulnerability in diesel, published on 5 Jun 2026. 
Exploitation: There is no known exploitation of GHSA-ggxf-9f6j-w742 in the wild and no public exploit code.

Affected packages and fixed versions:
- diesel (crates.io): affected all versions; fixed in 2.3.10
- diesel (crates.io): affected all versions; fixed in 2.3.10
- diesel (crates.io): affected from 0.0.0-0; fixed in 2.3.10

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-ggxf-9f6j-w742/ (Markdown: https://insights.sbomify.com/GHSA-ggxf-9f6j-w742/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-ggxf-9f6j-w742

---
From sbomify Insights: https://insights.sbomify.com/GHSA-ggxf-9f6j-w742/
Summaries are generated and may contain mistakes; the official description above is the record.
