# GHSA-m9p2-fxp5-v3fp: Diesel: Command injection in Diesel's implementation of `COPY FROM`/`COPY TO`

- Severity: Medium (CVSS:4.0, scored by GitHub) `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-04-24T12:00:00.000Z
- Modified: 2026-05-20T07:26:23.724Z
- Also known as: RUSTSEC-2026-0136
- Weaknesses: CWE-88

## Description

Diesel allows users to configure various options for PostgreSQL's `COPY FROM` and `COPY TO` statements. These configurations are partially provided as strings or characters. 

Diesel did not check if any these user-provided options contain a quote character `'`, which can lead to the injection of additional options in the current `COPY FROM`/`COPY TO` statement. 

This vulnerability affects any user of `COPY FROM`/`COPY TO` that passes user-provided input to any of the affected functions. It can result in modifications of options in the current statement, but it is not possible inject additional statements.

## 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 correctly escapes any quotes contained in the provided arguments.

(As written by GitHub Advisory Database.)

## Affected

- diesel (crates.io): before 2.3.8; from 0.0.0-0 before 2.3.8

## References

- <https://github.com/diesel-rs/diesel/pull/5042> (web)
- <https://github.com/diesel-rs/diesel> (package)
- <https://rustsec.org/advisories/RUSTSEC-2026-0136.html> (advisory, web)
- <https://crates.io/crates/diesel> (package)

## Sources

- GitHub Advisory Database: [GHSA-m9p2-fxp5-v3fp](https://github.com/advisories/GHSA-m9p2-fxp5-v3fp), CC-BY-4.0, modified 2026-05-20
- RustSec Advisory Database: [RUSTSEC-2026-0136](https://rustsec.org/advisories/RUSTSEC-2026-0136.html), CC0-1.0, modified 2026-05-20

---

Page: https://cve.day/GHSA-m9p2-fxp5-v3fp · Whole record: https://cve.day/GHSA-m9p2-fxp5-v3fp.json · Rebuilt by cve.day 2026-11-25T22:56:43.352Z
