CVE-2026-118260: Echo: BodyDump captures request and response bodies without size limits in v4
Echo v4's opt-in BodyDump middleware, in versions through v4.16.0, copies whole request and response bodies into memory with no limit. A client that sends large requests to a route using BodyDump can exhaust process memory. Upgrade github.com/labstack/echo/v4 to v4.16.1.
Published Oct 23, 2026 · Updated Oct 28, 2026 · Analysis Nov 2, 2026
What an attacker can do
BodyDump lets you log or inspect traffic through a callback. Before the fix it read each complete request body into memory before the handler ran, and kept each complete response body as well. Nothing capped either copy.
A client able to send large requests to a route that uses BodyDump therefore forces big allocations before the application sees the request. Large responses, including ones whose size the client can influence, add a second unbounded allocation. Repeated or concurrent requests can use up memory and take the process down. The CVSS 4.0 vector (8.2) shows network access, no privileges, and an availability-only impact. No data is exposed.
BodyDump is not on by default, so only services that registered it are in scope. A request-size limit in front of BodyDump reduces the request side. The response side needs separate handling, since a small request can still return a huge body.
Who is affected
Go module github.com/labstack/echo/v4 from 4.0.0 up to but not including 4.16.1, in applications that call the BodyDump middleware. Check:
go list -m github.com/labstack/echo/v4Then search your code for middleware.BodyDump.
github.com/labstack/echo/v4
- Ecosystem
- Go
- Affected
- >= 4.0.0, < 4.16.1
- Fixed in
- 4.16.1
- Check
go list -m github.com/labstack/echo/v4
How to fix it
Upgrade to Echo v4.16.1.
go get github.com/labstack/echo/[email protected]The patch adds MaxRequestBytes and MaxResponseBytes to BodyDumpConfig. Each defaults to 5 MiB when zero, and -1 restores unlimited capture. The handler still reads the whole request and the client still gets the whole response; only the callback's captured copy is bounded. Release notes say Go 1.26 or later is now required. Workarounds: turn BodyDump off on routes with large uploads or downloads, or enforce body-size limits before BodyDump and bound the responses your app produces.
How to tell if you were hit
Watch for process memory that climbs with large POST or PUT requests to routes with BodyDump, and for out-of-memory restarts of the Go service. Access logs showing a few clients sending very large bodies, or requests whose responses are very large, point to the abuse. Check your router setup for BodyDump use to see where you are exposed.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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.
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.
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.
Questions
- Is BodyDump enabled by default in Echo?
No. The advisory says it is opt-in. Only apps that register the middleware are affected.
- Does a request size limit fully protect me?
It reduces the request-side exposure. The advisory says response capture needs separate consideration, because a client may be able to cause large responses.
- What does the fix change by default?
BodyDump now captures at most 5 MiB of each request and response. Set MaxRequestBytes or MaxResponseBytes to -1 to restore the old behavior.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-118266
Echo has CSRF Protection Bypass via MethodOverride Rewriting POST to Safe Method
medium5.3Oct 28, 2026CVE-2026-118650
Echo's middleware.Static: `%2F`-encoded path bypasses route/group middleware guarding a statically-served path
high7.5Oct 28, 2026CVE-2026-118651
Echo: Reverse Proxy Forwards Attacker-Supplied X-Real-IP to Upstream by Default
medium5.3No fixOct 28, 2026CVE-2026-118652
Echo vulnerable to Reflected Cross-Site Scripting (XSS) via unsanitized JSONP callback in Context.JSONP / Context.JSONPBlob
medium6.1Oct 28, 2026CVE-2026-118653
Echo has Rate Limiter Bypass via Spoofed X-Forwarded-For Header in Default Configuration
medium5.3No fixOct 28, 2026CVE-2026-118654
Echo static file middleware route protection bypass via encoded dot-dot traversal
medium5.9Oct 28, 2026
