Gotenberg 8.29.1 Unauthenticated ExifTool Metadata Key Injection RCE (CVE-2026-42589)
by fineman999 · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-42589
- Category
- web
- Affected product
- Gotenberg (document/PDF conversion microservice)
- Affected versions
- 8.29.1 (fixed in 8.31.0)
- Disclosed
- 2026-07-05
- Patch status
- patched
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-06 |
| Author / Researcher | fineman999 |
| CVE / Advisory | CVE-2026-42589 |
| Category | web |
| Severity | Critical |
| CVSS Score | 9.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| Status | PoC |
| Tags | gotenberg, exiftool, command-injection, cwe-78, unauthenticated, rce, docker-lab, nuclei |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Gotenberg (document/PDF conversion microservice) |
| Versions Affected | 8.29.1 (fixed in 8.31.0) |
| Language / Platform | Go-based HTTP API service, wraps ExifTool (Perl) |
| Authentication Required | No |
| Network Access Required | Yes (HTTP access to the Gotenberg API, POST /forms/pdfengines/metadata/write) |
Summary
CVE-2026-42589 is an unauthenticated remote code execution vulnerability in Gotenberg 8.29.1’s metadata-writing endpoint. Gotenberg forwards user-supplied metadata JSON keys to ExifTool without rejecting control characters; a metadata key containing JSON-escaped newlines is split by ExifTool into additional command-line arguments, allowing an attacker to inject ExifTool’s -if/expression arguments and execute arbitrary Perl/system commands (e.g. via system('sleep 6')). The PoC lab runs both the vulnerable (8.29.1) and patched (8.31.0) Gotenberg Docker images, a raw-multipart Python timing probe, and a non-destructive nuclei detection template.
Vulnerability Details
Root Cause
The POST /forms/pdfengines/metadata/write endpoint accepts a metadata form field containing a JSON object whose keys are passed to the underlying ExifTool invocation as separate metadata-tag arguments. Because newline characters within a JSON string key are not rejected/sanitized before being forwarded to ExifTool, an attacker can embed \n sequences in a key to smuggle extra ExifTool command-line arguments/expressions (e.g. -if\nsystem('sleep 6')||1\n-Comment), which ExifTool then evaluates, resulting in command injection (CWE-78).
Attack Vector
- Attacker submits a multipart
POST /forms/pdfengines/metadata/writerequest containing a legitimate PDF file and ametadatafield whose JSON key contains embedded newlines, e.g.{"Title\n-if\nsystem('sleep 6')||1\n-Comment":"x"}. - Gotenberg passes the metadata keys through to its ExifTool invocation without stripping control characters.
- ExifTool interprets the injected newline-separated tokens as additional CLI arguments, including the
-ifconditional-expression flag, which evaluates the embedded Perlsystem()call. - A measurable delay (
sleep 6) and a500 Internal Server Errorresponse confirm command execution; the same technique can be used to run arbitrary OS commands instead ofsleep.
Impact
Unauthenticated arbitrary OS command execution as the Gotenberg service/container user, for any deployment exposing the metadata-write API to attacker-reachable input.
Environment / Lab Setup
Target: gotenberg/gotenberg:8.29.1 (vulnerable) vs. gotenberg/gotenberg:8.31.0 (patched), via Docker Compose
Attacker: Python 3 (stdlib only), curl, optional nuclei
Proof of Concept
PoC Script
See
manual_verify.py,CVE-2026-42589.yaml,docker-compose.yml,docker-compose.latest.yml, andsample.pdfin this folder.
| |
Against the vulnerable version, manual_verify.py uploads sample.pdf with a metadata key smuggling a system('sleep 6') ExifTool expression and observes a ~6-second-delayed 500 Internal Server Error (command executed); against the patched version it returns quickly with a 400 Bad Request. The nuclei template (CVE-2026-42589.yaml) automates the same non-destructive timing detection.
Detection & Indicators of Compromise
Signs of compromise:
- Multipart requests to
/forms/pdfengines/metadata/writewith newline-containing metadata keys - ExifTool child processes spawned by the Gotenberg container with unexpected arguments
- Unexpected outbound connections, file writes, or delays originating from the Gotenberg service host
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade Gotenberg to version 8.31.0 or later |
| Interim mitigation | Reject metadata keys containing control characters (newlines) before forwarding to ExifTool; restrict/authenticate access to the Gotenberg API; run Gotenberg in a sandboxed/least-privilege container |
References
Notes
Mirrored from https://github.com/fineman999/POC_CVE-2026-42589 on 2026-07-05.
| |