llamaCVEVulnerability Intelligence
/
Advisory · GitHub · crates.io · lettre

GHSA-PMVC-X69F-5P9F

SMTP `read_response`: a reply line without LF is buffered whole before the length check, and the reply is re-parsed after every line

Sin parche publicado
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición2 dDesde la divulgación, 17 nov 2026, 11:56 a. m.
Detección1 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Monitoreo
Detectada +1
11:56 a. m.
12:06 p. m.
01:05 a. m.
12:54 a. m.
11:56 a. m.
03:10 a. m.
06:25 p. m.
09:39 a. m.
12:54 a. m.
FechaFaseEventoDetalle
Divulgación Publicada GHSA-PMVC-X69F-5P9F divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Hello,

I maintain Sealwax (https://github.com/PixDevsApps/sealwax), a Linux mail client that uses lettre's async SMTP connection; it vendors 0.11.23. Two faults in `read_response` let an SMTP server, or anyone on the path before STARTTLS, exhaust the client's memory or tie up a CPU thread for seconds per reply. Both are in the async and the sync reader. References are to `master` at 94b63ac5.

1. A line without LF is read whole before the line cap is checked

`src/transport/smtp/client/connection.rs:289` (the async reader at `client/async_connection.rs:364–371` is the same):

while self.stream.read_line(&mut buffer).map_err(error::network)? > 0 {
    if buffer.len() - pre > MAX_RESPONSE_LINE_BYTES {

`read_line` returns only at LF or EOF, so a server that sends bytes without a newline makes it append to `buffer` without bound. `MAX_RESPONSE_LINE_BYTES` (1,000, `client/mod.rs:57`) and `MAX_RESPONSE_BYTES` (100,000, `mod.rs:54`), added by PR #1143, are checked only once `read_line` has returned. Nothing but a caller's timeout or EOF ends it.

The greeting and the first EHLO reply are read before STARTTLS, so an on-path attacker can do this to any submission on port 587, not only a hostile server.

  • Measured in Sealwax's scripted test (0.11.23 with a 16 KiB line cap, TLS on localhost): the server had sent 80.7 MB when the client's 0.5 s timeout fired.
  • The fault was reported to Sealwax by FieldsFury Labs (GitHub fieldsfury). They measured a peak RSS of 203 MiB for a 200 MiB stream, with no cap but the connection's timeout. They haven't reported it to lettre.

2. The whole reply is parsed again after every line

The same loop calls `parse_response(&buffer)` (`src/transport/smtp/response.rs:301`) on the whole buffer after each line. For a reply of many continuation lines, the work is quadratic in their number. The 100,000-byte cap bounds it but leaves it large.

Measured in a release build (opt-level 3, no debug assertions; AMD Ryzen 9 5900X), lettre's own `parse_response` and the same loop over an in-memory reply, two runs each:

| Reply | Time |
| --- | --- |
| 4,000 lines of `250-x\r\n` then `250 ok\r\n` (28,008 bytes) | 0.25 s |
| 14,284 such lines (99,996 bytes, just under the cap) | 3.06–3.08 s |
| 16,666 lines of `250-\r\n` (just over the cap, ending in "too large") | 4.09–4.13 s |

A debug build took 268 s for 16,000 lines.

Because the reply is already buffered, the loop never returns `Pending`. So an async caller's timeout (`tokio::time::timeout` around `command()`) can't fire, and the executor thread is held for the whole parse. A server can repeat this on every reply of a session, and on every reconnect. It's related to #1027 (timeouts), but a timeout fix alone wouldn't stop it.

What we changed in Sealwax's vendored copy

Both changes are marked "Sealwax's patch". The patch is 82 lines added and 15 removed over the two readers and `response.rs`; I'm happy to send it as a diff here.

  1. A line is read through `(&mut self.stream).take(MAX_RESPONSE_LINE_BYTES as u64 + 1).read_until(b'\n', &mut line)` into a `Vec<u8>`, checked against the cap, then validated as UTF-8 and appended. At most one byte past the cap is ever read for a line.
  2. The whole reply goes to `parse_response` only when that can return more than `Incomplete`. `parse_response`'s grammar ends each line at a CRLF, so after each read:
  3. if the buffer ends with CRLF, the text since the previous CRLF is checked once with the same parsers as `many0`'s item (`parse_code`, `-`, `take_until("\r\n")`, CRLF). If it's a continuation line, reading goes on without the full parse.
  4. otherwise the text since the last CRLF is skipped while it starts like a line the parser waits on (`parse_code` then `-` or a space).

Every other case goes to `parse_response` as before, which then returns `Ok`, `Error` or `Failure`, so it runs about once per reply.

We compared the old and new loops on 2,000,000 random replies plus 26 built at the limits: no difference. The one designed exception is a line over the cap that also holds invalid UTF-8, which is now "line too long" rather than an encoding error. The 14,284-line reply takes 1.6 ms after the change.

Coordination

I'm sorry for the short notice. Sealwax releases 1.0.3 today, 2026-10-24, with these fixes in its vendored copy. The release also carries an unrelated credential fix that can't wait. Sealwax's advisory GHSA-chx5-p5h3-52m5 describes the faults as they affect Sealwax and says lettre 0.11.23 is affected. The patch will be public in Sealwax's repository, in commit a18d9da https://github.com/PixDevsApps/sealwax/commit/a18d9da1e1b87a173abb04f615704a5f12cb95e7 under `vendor/lettre/`, and you're welcome to take it as is. I'll gladly help with a lettre release or advisory. Credit for the first fault belongs to FieldsFury Labs, who found it in Sealwax.

Unrelated to security: #1168 (a configurable or longer line cap, because Microsoft 365 sends lines over 1,000 bytes) is still open; Sealwax uses 16 KiB.

Thanks for lettre.

Fredrick Thorsen, Sealwax maintainer

Versiones

Rangos afectados

Afectada Corregida Última
lettre≤ 0.11.23
0.11.23
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
crates.iolettre
Sin parche — — 0.11.23 afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/lettre/lettre/security/advisories/GHSA-pmvc-x69f-5p9f

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.