CVE-2026-118261: Echo: Decompress permits unbounded gzip expansion in v4
Impact
Echo v4's opt-in Decompress middleware exposed a gzip-decoded request stream without limiting its expanded size. A small compressed request could therefore produce a very large decoded body. Handlers that read or bind that body could consume excessive memory or CPU, and repeated or concurrent requests could cause denial of service.
The middleware is not enabled by default. A limit on the compressed request size alone does not bound the decompressed size. Applications that already apply an effective body limit after decompression have reduced exposure.
Affected versions and patch
Echo v4 versions through v4.16.0 are affected. Upgrade to v4.16.1.
The patch adds DecompressConfig.MaxDecompressedSize, defaulting to 100 MiB when zero. A value of -1 explicitly disables the limit. Reading beyond the cap returns ErrStatusRequestEntityTooLarge (HTTP 413), including through JSON and XML binding. Bodies exactly at the configured limit remain valid. Streaming enforcement requires callers to handle body-read errors.
Fix commit.
Workarounds
Disable gzip request decompression on exposed routes, or place BodyLimit after Decompress so the application limit applies to decoded bytes. Apply suitable request deadlines and concurrency limits as well.
Credits
Reported by @q490107865. The exact-limit behavior incorporates @Shubham-Padkonde's work in #3136.
Other sources
Echo is a Go web framework. From 4.0.0 until 4.16.1, Echo v4's opt-in Decompress middleware exposes a gzip-decoded request stream without limiting its expanded size. A small compressed request can expand into a very large body when a handler reads or binds it, consuming excessive memory or CPU and allowing repeated or concurrent requests to cause denial of service. The middleware is not enabled by default, and limiting only the compressed request size does not bound the decoded size. This issue is fixed in 4.16.1.
— Debian
Echo: Decompress permits unbounded gzip expansion in v4 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/v4to a version that resolves this vulnerability.Fixed in 4.16.1 - Upgrade
Upgrade
github.com/labstack/echoto a version that resolves this vulnerability.Fixed in 4.16.1 - Configuration
Disable gzip request decompression on exposed routes.
Echo v4 Decompress middleware gzip request decompression = disabled - Compensating control
Apply request deadlines and concurrency limits to reduce denial-of-service exposure from repeated or concurrent requests.
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications using Echo v4 from 4.0.0 through 4.16.0 are exposed only if they have enabled the opt-in Decompress middleware. The middleware is not enabled by default.
What does an attacker need to do to trigger the denial of service?
An attacker can send a small gzip-compressed request that expands into a very large decoded body when an application handler reads or binds the request. Repeated or concurrent requests can consume excessive memory or CPU.
Does a compressed request-size limit mitigate the issue?
No. Limiting only the compressed request size does not limit the size of the gzip-decoded request body.
What version fixes the issue?
The issue is fixed in Echo v4.16.1.