CVE-2026-118261: Echo: Decompress permits unbounded gzip expansion in v4
Echo v4's opt-in Decompress middleware, through v4.16.0, exposes a gzip-decoded request body with no cap on its expanded size. A small compressed request can inflate into a huge body and exhaust memory or CPU. 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
The Decompress middleware unpacks gzip-encoded request bodies for your handlers. Before the fix, the decoded stream had no size limit. A gzip bomb, a few kilobytes that expand to gigabytes, passes a limit on compressed size without trouble. Handlers that read or bind the body, for example with JSON or XML binding, then consume large amounts of memory or CPU.
Repeated or concurrent requests can make the service unavailable. The CVSS 4.0 vector (8.2) shows network access, no privileges, and an availability-only impact.
The middleware is off by default. An app that already enforces a body limit after decompression has reduced exposure. A limit placed before decompression does not help, since it counts compressed bytes only. This is the data amplification class of bug, CWE-409.
Who is affected
Go module github.com/labstack/echo/v4 from 4.0.0 up to but not including 4.16.1, in apps that register the Decompress middleware. Check:
go list -m github.com/labstack/echo/v4Then search your code for middleware.Decompress.
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 DecompressConfig.MaxDecompressedSize, which defaults to 100 MiB when zero. A value of -1 turns the limit off. Reading past the cap returns ErrStatusRequestEntityTooLarge (HTTP 413), including through JSON and XML binding. Bodies exactly at the limit stay valid. Callers must handle body-read errors. Workarounds from the advisory: disable gzip request decompression on exposed routes, or put BodyLimit after Decompress so the limit counts decoded bytes, and add request deadlines and concurrency limits.
How to tell if you were hit
Look for requests with Content-Encoding: gzip and a small Content-Length, followed by memory or CPU spikes in the service. Out-of-memory restarts of the Go process are a sign. After the upgrade, oversized bodies show up as 413 responses. Search your code for Decompress registration to see where you are exposed.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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.
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.
Questions
- Why does my compressed-size limit not protect me?
The limit counts compressed bytes. A small gzip file can expand to a very large body after decoding, so the advisory says a compressed-size limit alone does not bound the decompressed size.
- What is the default limit after the fix?
100 MiB of decompressed data. Set MaxDecompressedSize to -1 to disable it.
- Is Decompress on by default?
No. Only apps that add the middleware are affected.
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
