# GHSA-FFC3-939V-3WPW: HTTP logging middleware buffers allow an unauthenticated denial of service

- Database: GitHub
- Severity: CVSS 7.5 (High)
- Published: 2026-09-12
- Modified: 2026-09-12

## Affected versions

- github.com/bluenviron/mediamtx (Go): fixed in 1.19.1

## Description

Every HTTP server in MediaMTX (the HLS server, the WebRTC/WHIP-WHEP server, and, when enabled, the API, metrics, pprof and playback servers) wraps its handler chain with a logging middleware that calls `httputil.DumpRequest(r, true)` on every request. That call reads the whole request body into memory, and it runs **before authentication**, **before the route handler**, and **regardless of the configured log level**. There is no request body size limit anywhere in front of it. An unauthenticated remote attacker can send one or more requests with very large bodies (or many slow ones) to any listening HTTP port and force MediaMTX to allocate memory proportional to the data sent, exhausting host memory and crashing the process.

The HTTP server type used by all of MediaMTX's HTTP services builds its middleware chain in `internal/protocols/httpp/server.go` as `handlerOrigin` → `handlerLogger` → `handlerExitOnPanic`, with the application router (which contains the authentication middleware) sitting underneath all of it; the underlying `http.Server` sets `ReadTimeout` but has **no body size cap**. The logging middleware, `handlerLogger` in `internal/protocols/httpp/handler_logger.go`, calls `httputil.DumpRequest(r, true)`, which reads the request body in full into an in-memory buffer (growing by doubling) and replaces `r.Body` with a copy of those bytes — *before* the log call even checks whether the configured log level is `Debug`. The per-server `ReadTimeout` bounds only how long a request may take to arrive, not how many bytes it may contain, and it is per-connection, so concurrent connections aggregate; any router-level body-size limiting runs later, *after* `DumpRequest` has already drained the body into memory.

This is reachable with no special setup: the HLS server (default `:8888`) and the WebRTC server (default `:8889`) are enabled by default, and the API, metrics, pprof and playback servers share the same vulnerable `httpp.Server` type when enabled.

The impact is uncontrolled memory allocation leading to denial of service — any party that can reach a MediaMTX HTTP port can trigger it with no authentication and no user interaction, at the cost of only bandwidth and connection count to the attacker, versus memory exhaustion up to process/host crash for the target.

The fix (**PR #5858**) replaces the unbounded `httputil.DumpRequest(r, true)` call with a bounded read (`RequestForLog`, in `internal/protocols/httpp/request_for_log.go`) that peeks at most **10 KiB** of the body via `io.LimitReader`, truncates it, and re-attaches the remainder to `r.Body` for downstream handlers.

Weaknesses: CWE-770 (Allocation of Resources Without Limits or Throttling), CWE-400 (Uncontrolled Resource Consumption).

## References

- https://github.com/bluenviron/mediamtx/security/advisories/GHSA-ffc3-939v-3wpw

Page: https://cve.now/GHSA-FFC3-939V-3WPW

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
