CVE-2026-118263: Echo: BodyDump can discard BodyLimit overflow errors for unknown-length requests
Impact
Echo v5's BodyDump middleware captured a bounded prefix, drained the remaining request body while ignoring read errors, and then replaced the body with the captured prefix. With an outer BodyLimit, an unknown-length request such as an HTTP/1.1 chunked request, and a BodyDump capture limit below the BodyLimit threshold, an overflow detected during that drain could be discarded.
The handler could consequently process a truncated request and return success even though the original body exceeded the configured limit. This is a conditional size-policy bypass; no general authentication bypass, production data modification or denial of service is claimed. Known-length requests rejected before BodyDump runs are unaffected by this path.
Affected versions and patch
All v5 releases from v5.0.0 through v5.4.0 contain the affected drain-and-replace logic. Runtime reproduction confirmed v5.4.0; source comparison confirms the same request handling in v5.0.0.
Upgrade to v5.4.1. BodyDump now captures only the configured prefix for logging and reconstructs the handler's reader from that prefix plus the unread original stream. It preserves the original closer and read errors instead of silently draining the rest. Fix commit.
Streaming BodyLimit enforcement still requires the application to consume the request body and handle read errors. The BodyDump capture cap is a logging cap, not an application body limit.
Workarounds
Disable BodyDump on affected routes, or ensure the BodyLimit overflow is detected during the initial capture by setting the capture limit above the enforced body limit. Upgrading is recommended because it also preserves the complete body for handlers.
Credits
Reported by @Duodum. The fix incorporates @jakezwang's request-body preservation work in #3105.
Other sources
Echo is a Go web framework. From 5.0.0 until 5.4.1, Echo v5's BodyDump middleware can discard a BodyLimit overflow error for an unknown-length request when BodyDump's capture limit is below the BodyLimit threshold. BodyDump drains the remaining body while ignoring read errors and replaces it with the captured prefix, so an HTTP/1.1 chunked request can be truncated and processed successfully even though the original body exceeded the configured limit. Known-length requests rejected before BodyDump runs are unaffected, and the issue does not establish a general authentication bypass or denial of service. This issue is fixed in 5.4.1.
— MITRE
Echo: BodyDump can discard BodyLimit overflow errors for unknown-length requests in github.com/labstack/echo
— OSV
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/labstack/echo/v5to a version that resolves this vulnerability.Fixed in 5.4.1 - Upgrade
Upgrade
github.com/labstack/echoto a version that resolves this vulnerability.Fixed in 5.4.1 - Configuration
Disable BodyDump on affected routes.
Echo v5 BodyDump BodyDump = disabled - Configuration
Set the BodyDump capture limit above the enforced BodyLimit so overflow is detected during the initial capture.
Echo v5 BodyDump capture limit = above the enforced BodyLimit threshold
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Echo v5 deployments from 5.0.0 through 5.4.0 are affected when BodyDump is used with a capture limit below the configured BodyLimit threshold. The affected request pattern is an HTTP/1.1 request with an unknown body length, such as a chunked request.
What must an attacker do to trigger the behavior?
An attacker must send an unknown-length request whose body exceeds BodyLimit while BodyDump captures only a smaller prefix. BodyDump can then drain the remainder while ignoring the overflow error and replace the request body with the captured prefix.
Are normal requests with a declared content length affected?
No. Known-length requests that exceed the limit are rejected before BodyDump runs.
What should teams do if they cannot patch immediately?
The provided information identifies the risky configuration as using BodyDump with a capture limit below BodyLimit for unknown-length requests. Avoid that combination where possible until updating to the fixed 5.4.1 release.