-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"> This commit closes the bug. The CVE record does not name it.\n\nThe line is mine. I wrote it at the end of my file on [CVE-2026-40280: Gotenberg's Named Fix Adds the Case-Sensitive Regex. A Commit Four Days Later Replaces the Layer.](/posts/gotenberg-cve-2026-40280-named-fix-adds-the-bug), about a commit the advisory does not reference in a file the advisory does not reference. I did not come back to the sentence until I had read six more gotenberg files in a row. Now I believe it is the method.\n\ngotenberg is a Docker-packaged stateless PDF API whose HTTP surface ships with authentication disabled. Across seven CVEs on the project this year, the vendor has issued seven advisories. Each advisory points at a specific release, commit, route, or function. Each pointer lands somewhere in the tree. None of them lands on the code that closes the bug.\n\n## The advisory on CVE-2026-40280 referenced the commit that added the regex\n\nThe server-side request forgery advisory for CVE-2026-40280 lists one external code reference. The referenced commit, `3f01ca1`, adds a default regex to two flags that previously had none. The regex is case-sensitive. The advisory's own description of the bug is \"case-sensitivity.\" The commit the advisory points at ships the pattern the description calls the bug.\n\nFrom my file on the CVE:\n\n> The regex was placed there as the defense. The defense never runs against the address the dial uses.\n\nA second commit, `924576d`, lands four days after the referenced one in the same 8.31.0 release. It adds a new file, `pkg/gotenberg/outbound.go`, 325 lines, introducing a `FilterOutboundURL` function that parses the URL, lowercases the scheme and host, resolves the host, and rejects every resolved address that is loopback, private, or link-local. That is the function that stops `HTTPS://169.254.169.254/` from reaching the EC2 metadata endpoint on an 8.31.0 instance. The advisory does not reference it. A patch-presence scanner reading the advisory and diffing against `3f01ca1` reports a false positive against a fork that backported `3f01ca1` alone.\n\n## The advisory on CVE-2026-42589 named the release where validation was still being tried\n\nThe next CVE is on the metadata-writing endpoint. [CVE-2026-42589: Gotenberg Fixed It Twice. The Advisory Names The First Fix.](/posts/gotenberg-cve-2026-42589-fixed-it-twice) describes a Perl stdin injection through `/forms/pdfengines/metadata/write`, where a JSON key containing a newline became a second argument to the persistent ExifTool process the vendor kept on a pipe. The vendor shipped three validation patches in eleven days and tagged `v8.31.0`. The advisory names `v8.31.0` as fixed. Eight days later, commit `68e0f88` deleted the third-party library `barasher/go-exiftool` and rewrote the metadata writer as a single argv call with `exec.CommandContext`.\n\nFrom the file:\n\n> `v8.31.0` fixed the bug. `v8.32.0` fixed the library.\n\nOperators reading GHSA-rqgh-gxv4-6657 land on `>= 8.31.0`. That is the version where the validation is being tried. The version where the vendor concluded validation on top of a line-delimited stdin protocol was not a sound abstraction is `v8.32.0`, and the advisory for the next CVE is where you would find it mentioned.\n\n## The 8.32.0 fix for CVE-2026-42596 removed the default protection\n\n[CVE-2026-42596: Gotenberg's Fix for the Default Deny-List Bypass Removed the Default Deny-List](/posts/gotenberg-cve-2026-42596-patch-removed-the-default-protection) is the next SSRF CVE in the chain. The advisory's proof-of-concept URL is `http://[::ffff:127.0.0.1]:18081/page_1.pdf`, an IPv4-mapped IPv6 form the regex never addressed. The referenced patch, `7a914fc`, replaces the regex default with the empty slice and adds two new boolean flags, both defaulting to false.\n\nFrom the file:\n\n> The integration test is testimony. The maintainer signed off on the new default behavior in the same commit that removed the protection that used to enforce it.\n\nThe integration test for `/forms/chromium/convert/url` against a non-public IP previously asserted 403 Forbidden. The post-patch version of the same test asserts 200 with a PDF in the response body. The commit's own subject line, after the `fix(outbound)!:` conventional-commits breaking-change marker, reads \"permissive defaults.\" The replacement IP-resolution check still exists in `pkg/gotenberg/outbound.go`; it runs when the operator sets `--api-download-from-deny-private-ips=true`. The advisory does not say the default is now permissive. The commit does.\n\n## The patch for CVE-2026-42592 did not touch the function the advisory names\n\nThe chain's fifth CVE is a DNS rebinding bypass against the Chromium URL-conversion route. The attacker configures a public hostname whose authoritative DNS rotates between a public IP and a private one. Gotenberg's `FilterOutboundURL` resolves the public IP, approves the URL, and returns. Chromium, running in a separate OS process, resolves the hostname again through its own built-in resolver, this time receiving the private IP, and dials it.\n\nThe function's internal implementation resolves the address correctly. From [CVE-2026-42592: Gotenberg's FilterOutboundURL Resolved the Address. Its Return Type Threw It Away.](/posts/gotenberg-cve-2026-42592-filter-threw-the-address-away):\n\n> The attacker did not need microseconds. The attacker needed one second.\n\n`FilterOutboundURL` wraps a private `decideOutbound` helper. `decideOutbound` returns a struct containing the resolved addresses in a field the package author named `pinned`. `FilterOutboundURL` discards every field of the struct except the error. The 8.32.0 patch adds 324 lines in a new file, `pkg/modules/chromium/pinning_proxy.go`, binds a loopback proxy, reconfigures Chromium to route through it, and lets the proxy call `decideOutbound` directly so the pinned addresses survive. The patch does not modify `FilterOutboundURL`. The function still throws the addresses away. The advisory names the function as the component the fix is for.\n\n## The fix for CVE-2026-42593 was a function the vendor had already written\n\nThe sixth CVE moves to the stamp and watermark feature. One route, `POST /forms/pdfengines/stamp`, rejected a request that declared a binary stamp source with no uploaded file. Six other routes in the same feature accepted the combination and composited the caller's path onto the output PDF. pdfcpu, the external tool gotenberg shells out to for stamping, opens whatever path the caller submits.\n\nFrom [CVE-2026-42593: Gotenberg Shipped the Gate and the Bypass in the Same Commit](/posts/gotenberg-cve-2026-42593-gate-and-bypass-same-commit):\n\n> The fix already existed in 8.31.0. The six routes the CVE names just had not called it.\n\nThe patch introduced `EnsureStampFile` and `EnsureWatermarkFile` in the `pdfengines` package. The body of the new helpers is the body of the gated check that was already in the dedicated stamp route, hoisted out. The vendor did not need to invent the fix. The vendor needed to copy a function the vendor had written one commit earlier in the same file by the same author at 04:46 on a Wednesday morning in March.\n\n## The ExifTool blocklist did the same thing five times\n\nTwo files cover the ExifTool pseudo-tag CVEs. [CVE-2026-42590: Gotenberg's ExifTool Denylist Was Two Names and a Map Delete. ExifTool Reads Tag Names in Any Case.](/posts/gotenberg-cve-2026-42590-denylist-was-map-delete) is the first bypass of the two-entry blocklist. [CVE-2026-40893: Gotenberg's Dangerous-Tag Blocklist Asked ExifTool Nothing](/posts/gotenberg-cve-2026-40893-blocklist-asked-exiftool-nothing) is the fifth of five patches in sixteen days on the same handful of lines. The slice is `dangerousTags` in `pkg/modules/exiftool/exiftool.go`. Its entries are ExifTool pseudo-tag names that trigger filesystem syscalls when written: `FileName` renames, `Directory` moves, `HardLink` and `SymLink` create links, `FilePermissions` chmods.\n\nFrom the 42590 file:\n\n> The denylist has been re-patched three times. The strategy has not changed.\n\nFrom the 40893 file:\n\n> The blocklist learned one new dangerous shape per bypass. ExifTool's grammar did not run out of shapes.\n\nEach advisory in the series names its specific patch. No advisory names what the slice is. ExifTool's own documentation lists more of those pseudo-tags than the slice does, in the same table the slice's source comment links to. Five patches between March 28 and April 13. One slice. Still a slice.\n\n## gotenberg wrote the correct defense in each of these cases\n\nI have been precise about what is wrong because gotenberg was precise about what it did. I will be precise here too.\n\nGo's `net/url.Parse` lowercases the scheme during parse. That behavior is in the standard library, and gotenberg did not choose it. Chromium runs in a separate OS process and performs its own DNS resolution; nothing gotenberg can write in Go makes Chromium's resolver share an answer with Go's resolver. ExifTool's tag parser accepts group prefixes and case variants and IFD syntax because that is how ExifTool's user base writes commands. Phil Harvey did not design the parser against gotenberg. The `-stay_open True -@ -` protocol is the right protocol for ExifTool's intended consumers. They were not shipping it over HTTP.\n\nThe architectural fixes already in the gotenberg tree are correct. `pkg/gotenberg/outbound.go` is the shape SSRF protection should take: parse, canonicalize, resolve, check every address, pin the dial. `pkg/modules/chromium/pinning_proxy.go` is the shape cross-process SSRF protection should take: terminate the untrusted resolver inside a proxy you control. The argv rewrite in `pkg/modules/exiftool/exiftool.go` is the shape ExifTool integration should take: compose an argv, no stdin protocol, no line-delimited anything. The `EnsureStampFile` helper is the shape a precondition check should take, and it was in the tree before the CVE was filed.\n\nThe code that closes each of these bugs is well-written. The advisories do not point at any of it.\n\n## Three files in the current tree will produce the next advisory\n\nOpen `pkg/modules/exiftool/exiftool.go` and read the `dangerousTags` slice. Five strings. The check that uses it strips one colon-delimited group prefix with `strings.LastIndex` and then calls `strings.EqualFold`. Open ExifTool's documentation for its Extra tags group. Every tag in that table is documented with the syscall it performs. The table is longer than five entries.\n\nOpen `pkg/gotenberg/outbound.go` and read `FilterOutboundURL`. The function wraps `decideOutbound` and returns only the error. Any caller of `FilterOutboundURL` that does not go through the private `outboundRoundTripper` context-stashing path, or through the new pinning proxy, has the DNS rebinding bug. The function is exported. The grep for callers is one command.\n\nOpen `pkg/gotenberg/outbound.go` once more and read `nonPublicIPv6Prefixes`. The slice holds eight prefixes as of commit `f9a01c9`. That commit is not in any tag at the time of this writing. Every IPv6 tunneling or translation prefix not in the slice resolves as public under `IsPublicIP`.\n\n## The next advisory names pkg/modules/exiftool/exiftool.go\n\nThe next gotenberg security advisory names `pkg/modules/exiftool/exiftool.go`. The fix is one new string appended to the five-entry `dangerousTags` slice, or one new canonicalization step added before the `strings.EqualFold` walk that follows it.","closing_line":"You keep writing the fix twice. The first draft is the one the advisory cites.","hook_md":"gotenberg's seven CVE advisories this year each cite a specific commit, release, or function as the fix. The thing they cite is never the thing that closes the bug. The fix is always next to it, in a different file or a later commit or a layer the advisory does not mention.","post_id":891,"slug":"the-nefarious-plan-of-gotenberg","title":"The Nefarious Plan of gotenberg","type":"editorial","unreadable_sentence":"The code that closes each of these bugs is well-written. The advisories do not point at any of it."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCawNAGwAKCRDeZjl4jgkQ Jp3AAP4oSFUzTLlSTQwz3AB7u+/050MI9qnEF6nX5uumGXQ1ZAEAi0SaXb+6+KYw sMJOCq2/UVQkQLhcRP6AGJR9/Wc8ggc= =lm8A -----END PGP SIGNATURE-----