---
id: "GHSA-f48p-c9v4-h7xv"
kind: "vulnerability"
aliases: ["GHSA-f48p-c9v4-h7xv"]
title: "Echo: BodyDump captures request and response bodies without size limits in v4"
severity: "high"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "github.com/labstack/echo/v4", "fixed": ["4.16.1"], "affected": ">= 4.0.0, < 4.16.1", "ecosystem": "go"}]
ecosystems: ["go"]
tags: ["api-servers", "cwe-400", "cwe-770", "echo", "go", "package", "self-hosted"]
not_affected_if: ["bodydump-not-used", "request-limits-enforced", "version-4.16.1-or-later"]
published_at: "2026-10-23T20:48:44+00:00"
first_seen_at: "2026-10-23T20:59:05+00:00"
updated_at: "2026-10-23T21:00:36+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-f48p-c9v4-h7xv", "first_seen_at": "2026-10-23T20:59:05+00:00"}]
---

# Echo: BodyDump captures request and response bodies without size limits in v4

Echo v4's opt-in BodyDump middleware reads entire request bodies and retains entire response bodies in memory with no capture limit. A client who can send large requests or trigger large responses can exhaust server memory and crash the service.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- go:github.com/labstack/echo/v4 affected >= 4.0.0, < 4.16.1 fixed 4.16.1

## How to check

Search the code for `middleware.BodyDump` or `BodyDump(` in routes or groups.
Check go.mod for github.com/labstack/echo/v4 and whether the version is below 4.16.1.

## Fix

Upgrade github.com/labstack/echo/v4 to v4.16.1 or later.
If upgrading is not possible, disable BodyDump on exposed routes, especially large uploads and downloads, or enforce body-size limits before it runs.

## Timeline

- 2026-10-23T20:59:05+00:00 ghsa https://github.com/advisories/GHSA-f48p-c9v4-h7xv

## From the sources

## Impact

Echo v4's opt-in BodyDump middleware read complete request bodies into memory and retained complete response bodies without a capture limit. A client able to submit large requests to a route using BodyDump could cause large allocations before the application handler ran. Large responses, including responses whose size can be influenced by a client, also caused an additional unbounded capture allocation.

Repeated or concurrent requests can exhaust process memory and cause denial of service. BodyDump is not enabled by default. Deployments with effective request limits may reduce the request-side exposure; response capture requires separate consideration.

## Affected versions and patch

Echo v4 versions through v4.16.0 are affected. Upgrade to [v4.16.1](https://github.com/labstack/echo/releases/tag/v4.16.1).

The patch adds `BodyDumpConfig.MaxRequestBytes` and `MaxResponseBytes`, each defaulting to 5 MiB when zero. A value of `-1` explicitly restores unlimited capture. The complete request remains readable by the handler and the complete response is delivered to the client; only the callback's captured data is bounded. Request close behavior and read errors are preserved.

[Fix commit](https://github.com/labstack/echo/commit/3fb0ba7e17645bb65611e2a08875d0a2f65c421f).

## Workarounds

Disable BodyDump on exposed routes, particularly large uploads and downloads. Alternatively, enforce body-size limits before BodyDump and independently bound the responses that the application generates.

## Credits

Reported by @q490107865. The patch also incorporates request-body preservation work from @jakezwang in [#3105](https://github.com/labstack/echo/pull/3105).

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
