# GHSA-rcx8-48pc-v9q8: mail-internals use-after-free vulnerability in `vec_insert_bytes`

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2023-08-07T12:00:00.000Z
- Modified: 2023-11-08T04:22:42.487Z
- Also known as: RUSTSEC-2023-0054

## Description

Incorrect reallocation logic in the function [`vec_insert_bytes`](https://docs.rs/mail-internals/0.2.3/mail_internals/utils/fn.vec_insert_bytes.html) causes a use-after-free.

This function does not have to be called directly to trigger the vulnerability because many methods on [`EncodingWriter`](https://docs.rs/mail-internals/0.2.3/mail_internals/encoder/struct.EncodingWriter.html) call this function internally.

The mail-\* suite is unmaintained and the upstream sources have been actively vandalised.
A fixed `mail-internals-ng` (and `mail-headers-ng` and `mail-core-ng`) crate has been published which fixes this, and a dependency on another unsound crate.

(As written by GitHub Advisory Database.)

## Affected

- mail-internals (crates.io): from 0.2.0 up to 0.2.3; from 0.0.0-0

## References

- <https://github.com/rustsec/advisory-db/blob/main/crates/mail-internals/RUSTSEC-2023-0054.md> (web)
- <https://rustsec.org/advisories/RUSTSEC-2023-0054.html> (advisory, web)
- <https://crates.io/crates/mail-internals> (package)
- <https://git.sr.ht/~nabijaczleweli/mail-internals.crate/commit/05443c864b204e7f1512caf2d53e8cce4dd340fc> (web)

## Sources

- GitHub Advisory Database: [GHSA-rcx8-48pc-v9q8](https://github.com/advisories/GHSA-rcx8-48pc-v9q8), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2023-0054](https://rustsec.org/advisories/RUSTSEC-2023-0054.html), CC0-1.0, modified 2023-11-08

---

Page: https://cve.day/GHSA-rcx8-48pc-v9q8 · Whole record: https://cve.day/GHSA-rcx8-48pc-v9q8.json · Rebuilt by cve.day 2026-11-25T22:56:43.153Z
