Gotenberg Denial of Service via Context Pool Reuse
Gotenberg versions 8.31.0 and earlier are vulnerable to an unauthenticated denial-of-service attack where a race condition in the webhook middleware causes a panic and process termination when handling concurrent requests.
Gotenberg, a Docker-based stateless API for PDF files, is susceptible to a denial-of-service vulnerability (CVE-2026-42594) affecting versions 8.31.0 and earlier. The vulnerability stems from a race condition within the webhook middleware related to the reuse of echo.Context objects. When a webhook is triggered, the middleware spawns a goroutine and returns ErrAsyncProcess. This allows the Echo framework to recycle the context object back into a pool. If a concurrent request reclaims this context, the c.Reset() function clears the store. Should the webhook goroutine then reach the hardTimeoutMiddleware, an unchecked type assertion on a nil store entry will cause a panic, crashing the entire Gotenberg process. This vulnerability is exploitable by unauthenticated attackers capable of sending requests to the Gotenberg API, leading to service unavailability.
Attack Chain
- An attacker sends a request to the Gotenberg API that triggers a webhook (e.g., by using the
/forms/chromium/convert/htmlendpoint withGotenberg-Webhook-Urlheader). - The Gotenberg API spawns a goroutine to handle the webhook asynchronously and returns
api.ErrAsyncProcess. - The Echo framework returns the
echo.Contextobject to its internal pool. - A concurrent request acquires the recycled
echo.Contextobject from the pool. - The
c.Reset()function within Echo is called, clearing thec.storeof the recycled context. - The webhook goroutine eventually executes, and calls
next(c), which leads to thehardTimeoutMiddleware. - Inside the
hardTimeoutMiddleware, the code attempts to access the logger usingc.Get("logger").(*slog.Logger). - Since the context has been reset,
c.Get("logger")returns nil, causing a panic due to the unchecked type assertionnil.(*slog.Logger), which terminates the Gotenberg process.
Impact
Successful exploitation of this vulnerability results in a denial-of-service condition. The Gotenberg process crashes, interrupting any ongoing PDF conversions and causing the service to become unavailable. While auto-restart policies may restore the service, a sustained attack can keep the process in a constant restart loop, leading to prolonged unavailability. Because no authentication is required, any client capable of sending requests to the Gotenberg API can trigger the crash, making it easy to exploit.
Recommendation
- Apply the recommended fix by patching
pkg/modules/api/middlewares.go:398to guard the type assertion with a nil check as suggested in the advisory. - Implement the
defer recover()at the beginning of the webhook goroutine atpkg/modules/webhook/middleware.go:338to prevent panics from crashing the process. - Deploy the following Sigma rule to detect rapid Gotenberg process restarts which may indicate exploitation of this vulnerability: (see “Detect Gotenberg Process Crashes” rule below).
Detection coverage 2
Detect Gotenberg Process Crashes
mediumDetects rapid restarts of the Gotenberg Docker container, which may indicate exploitation of CVE-2026-42594
Detect Webhook Requests to Gotenberg
lowDetect requests with the Gotenberg-Webhook-Url header to monitor for potential abuse of webhooks
Detection queries are kept inside the platform. Get full rules →