CVE-2026-118655: Echo has a Static Middleware Double-Unescape Path Traversal
Echo's Static middleware decoded the request path a second time after Go's net/http had already decoded it, so double-encoded input like %252F could reach files under routes guarded by other middleware. Fixed in github.com/labstack/echo/v5 5.2.0 and github.com/labstack/echo/v4 4.15.3. The maintainers could not reproduce reads outside the root.
Published Oct 28, 2026 · Analysis Nov 1, 2026
What an attacker can do
middleware/static.go set pathUnescape := true and called url.PathUnescape() on a path that net/http had already decoded. That rebuilt separators and dot segments from double-encoded input. The original report claimed GET /%2e%2e%2fsecret.txt or /..%252fsecret.txt produced ../secret.txt and gave arbitrary file read.
The maintainers' own analysis is narrower. They could not reproduce reading files outside the configured root. What they confirmed is that a double-encoded slash (%252F) could reach a file under a guarded route when the Static middleware is registered globally. So a request could skip authentication or other checks attached to a sibling route, and the file was served from the static root.
The attacker needs only network access and no account. The result is disclosure of files inside the static root that the app meant to protect with route-level middleware. The CVSS rates complexity high, confidentiality high, and no integrity or availability effect. Apps that keep protected files outside the static root are not exposed.
Who is affected
github.com/labstack/echo/v5 before 5.2.0 and github.com/labstack/echo/v4 before 4.15.3, where the Static middleware (or Static/StaticFS) serves a directory that also contains files guarded by route-level middleware, especially with the middleware registered globally.
go list -m github.com/labstack/echo/v5 github.com/labstack/echo/v4The maintainers recommend 5.4.0 and 4.16.0 or later, since later releases fix related encoded and dot-segment bypasses.
github.com/labstack/echo/v5
- Ecosystem
- Go
- Affected
- < 5.2.0
- Fixed in
- 5.2.0
- Check
go list -m github.com/labstack/echo/v5
github.com/labstack/echo/v4
- Ecosystem
- Go
- Affected
- < 4.15.3
- Fixed in
- 4.15.3
- Check
go list -m github.com/labstack/echo/v4
How to fix it
The fix landed in echo/v5 5.2.0 and echo/v4 4.15.3, where Static stopped unescaping an already decoded path (the fix commit sets pathUnescape := false). The v4.15.3 release notes also describe rejecting encoded separators (%2F, %5C). The maintainers advise going further, to 5.4.0 or 4.16.0, which add fixes for encoded and dot-segment paths.
go get github.com/labstack/echo/[email protected]Workaround from the advisory: keep files that need protection outside the Static middleware's root directory.
How to tell if you were hit
Look in access logs for static requests whose raw path contains %25 (an encoded percent sign) such as %252F, or %2e%2e, that return 200 for files you expect to be behind authentication. Compare with 401 or 403 responses for the same file on its guarded route. Test your app by requesting a protected file with its slash written as %252F.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
Commit a9ede66a (PR #3006, issue #2599) silently fixed a path traversal vulnerability in the Echo web framework's static file middleware.
Vulnerability
The static middleware double-unescaped URL paths. Go's net/http already decodes Request.URL.Path, but middleware/static.go unconditionally called url.PathUnescape() again:
// BEFORE (vulnerable)
pathUnescape := trueThis reassembled path traversal sequences from double-encoded input. An attacker could send GET /%2e%2e%2fsecret.txt or /..%252fsecret.txt and the double-unescape would produce ../secret.txt.
Fix
// AFTER (fixed)
pathUnescape := falseThe commit's test TestStatic_percentEncodedTraversalIsBlocked explicitly verifies traversal vectors are blocked.
Impact
Arbitrary file read from server filesystem via percent-encoded path traversal.
References
- Fix: https://github.com/labstack/echo/commit/a9ede66a
- Issue: https://github.com/labstack/echo/issues/2599
- PR: https://github.com/labstack/echo/pull/3006
Patches
Fixed in github.com/labstack/echo/v5 v5.2.0 and github.com/labstack/echo/v4 v4.15.3, where the Static middleware stopped unescaping an already decoded path. Maintainer analysis: reading files outside the configured root could not be reproduced; the confirmed impact was that a double-encoded slash (%252F) could reach a file under a guarded route when the Static middleware is registered globally. Upgrade to v5.4.0 / v4.16.0 or later, which also includes related fixes for encoded and dot-segment paths.
Workarounds
Keep files that need protection outside the Static middleware's root directory.
Questions
- Could an attacker read any file on the server?
The original report said so, but the maintainers could not reproduce reads outside the configured root. They confirmed only that a double-encoded slash could reach a file under a guarded route when Static is registered globally.
- Which versions fix CVE-2026-118655?
echo/v5 5.2.0 and echo/v4 4.15.3. The maintainers recommend 5.4.0 or 4.16.0 or later, which also carry related fixes.
- Is there a workaround?
Keep files that need protection outside the Static middleware's root directory.
References
Read for this analysis:
- https://github.com/advisories/GHSA-xwq5-6cqp-vx96
- https://github.com/labstack/echo/releases/tag/v4.15.3
- https://github.com/labstack/echo/security/advisories/GHSA-xwq5-6cqp-vx96
- https://github.com/labstack/echo/issues/2599
- https://github.com/labstack/echo/pull/3006
- https://github.com/labstack/echo/commit/a9ede66a5a7196411131beb1ee801e75bbaf7ac6
- https://github.com/labstack/echo/commit/c3fa2a27ff92b2b8db360de614f999ef1da24725
- https://github.com/labstack/echo/releases/tag/v5.2.0
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
