-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The denylist was two names and a `delete`\n\nThe vulnerable function is `WriteMetadata` in `pkg/modules/exiftool/exiftool.go`. The route is `POST /forms/pdfengines/metadata/write`. A multipart form arrives with a PDF file part and a `metadata` field whose value is a JSON object. `FormDataPdfMetadata` (`pkg/modules/pdfengines/routes.go:107`) unmarshals the JSON into a `map[string]any` and hands it down to `WriteMetadataStub`, which hands it to `engine.WriteMetadata`. Inside `WriteMetadata`, the defense is this:\n\n```go\n// Filter user-supplied metadata to prevent ExifTool pseudo-tags from\n// triggering dangerous side effects like file renames or moves.\n// See https://exiftool.org/TagNames/Extra.html.\ndangerousTags := []string{\n \"FileName\", // Writing this triggers a file rename in ExifTool\n \"Directory\", // Writing this triggers a file move in ExifTool\n}\nfor _, tag := range dangerousTags {\n delete(metadata, tag)\n}\n```\n\nThe comment links to ExifTool's pseudo-tag reference. The same reference page also lists `HardLink` (\"create a hard link to a copy of the file\"), `SymLink` (\"create a symbolic link to the file\"), and `FilePermissions` (\"set the file permissions\"). The author cited the page, picked two entries, and stopped.\n\nThe second weakness is the operation. `delete(metadata, \"FileName\")` removes the entry whose key is the literal byte sequence `F-i-l-e-N-a-m-e`. A submission with key `filename` survives unchanged into the argv loop. ExifTool then processes tag names case-insensitively, resolves `filename` to the canonical `FileName` pseudo-tag, and renames the working file.\n\nThe bypasses available against v8.29.0 are the cross product. Two missing entries (`HardLink`, `SymLink`) bypass the list dimension. Any non-canonical casing of `FileName` or `Directory` (`filename`, `directory`, `FILENAME`) bypasses the case dimension. The map delete sees neither.\n\n## What reaches the argv\n\nA v8.29.0 instance reachable on port 3000 turns this request into a hard link from `/srv/gotenberg-uploads/.pdf` to a path the caller chooses:\n\n```bash\ncurl -X POST http://gotenberg:3000/forms/pdfengines/metadata/write \\\n -F \"files=@input.pdf\" \\\n -F 'metadata={\"HardLink\":\"/srv/data/poisoned.pdf\"}'\n```\n\n`HardLink` is not in the v8.29.0 slice, so it never reaches the `delete` loop. The follow-on loop in `WriteMetadata` iterates `metadata` and appends `-HardLink=/srv/data/poisoned.pdf` to the argv. The actual exec is:\n\n```\nexiftool -overwrite_original -HardLink=/srv/data/poisoned.pdf /srv/gotenberg-uploads/.pdf\n```\n\nExifTool's `HardLink` pseudo-tag invokes `link(2)` from the working file to the attacker-supplied path. The destination's parent directory needs to be writable by the gotenberg process, but the destination's name and full path are the attacker's. `SymLink` is the same primitive against `symlink(2)`. `FilePermissions` is `chmod(2)` on the working file with attacker-chosen bits. None of the three were on the v8.29.0 list.\n\nThe case-fold variant of the file-rename bypass:\n\n```bash\ncurl -X POST http://gotenberg:3000/forms/pdfengines/metadata/write \\\n -F \"files=@input.pdf\" \\\n -F 'metadata={\"filename\":\"owned.pdf\"}'\n```\n\n`delete(metadata, \"FileName\")` does not match the key `\"filename\"`. The argv becomes `-filename=owned.pdf`. ExifTool's `Image::ExifTool::DoSetTag` lowercases the tag name during lookup, resolves it to `FileName`, and renames the working file in its parent directory. Gotenberg is a stateless Docker API; the working file lives in a per-request temp directory the process owns. The rename happens there, the downstream pipeline misses the file at its expected name, and the request returns an error. The rename has already occurred.\n\n## The v8.30.0 patch and what it does not say\n\nCommit 15050a3, titled \"fix(exiftool): case-insensitive comparison and expanded blocklist,\" is the named fix for CVE-2026-42590. It ships in v8.30.0 on April 5, 2026. The diff:\n\n```diff\n+// Filter user-supplied metadata to prevent ExifTool pseudo-tags from\n+// triggering dangerous side effects like file renames, moves, or link\n+// creation. Comparison is case-insensitive because ExifTool processes\n+// tag names case-insensitively.\n+// See https://exiftool.org/TagNames/Extra.html.\n dangerousTags := []string{\n \"FileName\", // Writing this triggers a file rename in ExifTool\n \"Directory\", // Writing this triggers a file move in ExifTool\n+ \"HardLink\", // Writing this creates a hard link in ExifTool\n+ \"SymLink\", // Writing this creates a symbolic link in ExifTool\n }\n-for _, tag := range dangerousTags {\n- delete(metadata, tag)\n+for key := range metadata {\n+ for _, tag := range dangerousTags {\n+ if strings.EqualFold(key, tag) {\n+ delete(metadata, key)\n+ }\n+ }\n }\n```\n\nTwo new tag names. One comparison upgrade. The `strings.EqualFold` closes the case-sensitivity bypass. `HardLink` and `SymLink` close the missing-entries bypass. The patch reads as the defense the v8.29.0 function should have been.\n\nThe comment the patch adds is the sentence the post turns on. \"Comparison is case-insensitive because ExifTool processes tag names case-insensitively.\" The developer learned a specific fact about ExifTool's tag matcher and added an `EqualFold` to handle the axis the fact describes. The comment is testimony: it names exactly one of the dimensions on which the two parsers disagree. There are at least three more.\n\nThe fix the patch does not include: ExifTool's group-prefix syntax. ExifTool accepts `File:FileName`, `System:Directory`, and `a:HardLink` as group-prefixed forms of the same pseudo-tags. The prefix is stripped by `SetNewValue` in `Writer.pl` before tag matching, so all forms resolve to the same operation. `strings.EqualFold(\"File:FileName\", \"FileName\")` returns false because the comparison runs over the literal string. The prefixed forms survive the v8.30.0 denylist intact, reach the argv as `-File:FileName=evil.pdf`, and ExifTool renames the file.\n\nThat bypass is filed as [CVE-2026-40893](/posts/gotenberg-cve-2026-40893-blocklist-asked-exiftool-nothing) and patched in v8.32.0 by commit 68e0f88, which adds `strings.LastIndex(key, \":\")` to strip the prefix before `EqualFold` runs. `FilePermissions` is added to the dangerous-tag list separately in v8.31.0 (commit 46e1909). The patch you are reading here closes two of the function's canonicalization axes and leaves the third in code for another twenty-five days.\n\n## The component is the bug class\n\nThe `dangerousTags` slice and its loop are a design-debt driver. The denylist for ExifTool pseudo-tags in Gotenberg has been re-patched three times in the same month on the same handful of lines:\n\n| Version | Date | What the patch added |\n|---|---|---|\n| v8.30.0 | 2026-04-05 | Case-insensitive `EqualFold`; `HardLink` and `SymLink` added to the list. (CVE-2026-42590.) |\n| v8.31.0 | 2026-04-16 | `FilePermissions` added to the list. |\n| v8.32.0 | 2026-04-30 | `strings.LastIndex(key, \":\")` strips group prefixes before `EqualFold`. (CVE-2026-40893.) |\n\nThe shape is the same every time. ExifTool's tag matcher is the canonicalizer. It accepts case variants, group-prefixed variants, IFD-syntax variants, and a documented set of pseudo-tag names, and resolves all of them to the same write operation. Gotenberg's denylist is implemented against the string the caller submitted. The action is implemented against the canonical name ExifTool resolved to. Each fix closes one axis of disagreement between the two parsers and leaves the rest. The next round of the iteration finds the next axis.\n\nThe pattern is gate-before-canonicalize. Prior Gotenberg exhibits of the same pattern lived in URL parsing: [CVE-2026-40280](/posts/gotenberg-cve-2026-40280-named-fix-adds-the-bug) on URL scheme (`HTTPS://` clearing a case-sensitive `^https?` byte-match before `net/url.Parse` lowercased it for the dial), and [CVE-2026-42596](/posts/gotenberg-cve-2026-42596-patch-removed-the-default-protection) on URL host (`[::ffff:127.0.0.1]` evading a deny-list character class before `net/netip.ParseAddr` unmapped it to the loopback IPv4). This exhibit moves the same disease one organ over, from network to filesystem, and shows the pattern in its smallest possible form. The gate is `delete(map, \"FileName\")`. The canonicalizer is `Image::ExifTool::DoSetTag`. There are no middleware layers between them, no proxies, no two-machine handoffs. Two lines of Go and one Perl function. The disagreement still buys an arbitrary-path hard link.\n\nThe structural fix for the bug class is to canonicalize the user-supplied key against ExifTool's resolution rules before checking it against the denylist (or, equivalently, to ask ExifTool what canonical tag the key resolves to and check that). None of the three Gotenberg patches does this. v8.30.0 adds two strings and one helper. v8.31.0 adds another string. v8.32.0 adds another `strings` call. ExifTool's resolution rules have more axes than this strategy will reach.\n\nPoC: [GHSA-7v3r-m9c8-r855](https://github.com/advisories/GHSA-7v3r-m9c8-r855)","closing_line":"The denylist has been re-patched three times. The strategy has not changed.","hook_md":"The v8.29.0 ExifTool denylist in Gotenberg was four lines: a slice with two tag names, a `for` loop, and `delete(metadata, tag)`. ExifTool has five filesystem-side-effect pseudo-tags. The slice named two. The `delete` was case-sensitive; ExifTool's tag matcher is not. CVE-2026-42590 is the bypass each of those two facts produces.","post_id":430,"slug":"gotenberg-cve-2026-42590-denylist-was-map-delete","title":"CVE-2026-42590: Gotenberg's ExifTool Denylist Was Two Names and a Map Delete. ExifTool Reads Tag Names in Any Case.","type":"initial","unreadable_sentence":"The author cited the page, picked two entries, and stopped."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCamJemAAKCRDeZjl4jgkQ JkN7AP9Q1WoaO8ePruXB3JNLBJZc4hgc4ES8Wha+hzG3+111jAEAhZtKYFb6eSwE 1zubdNiDI+Gn9YfZPRT4QfjXLXR1KQA= =WImD -----END PGP SIGNATURE-----