Executive brief
Echo is a popular Go web framework used to build REST APIs and web applications. A mismatch in how the router and static file handler process URL-encoded slashes allows attackers to bypass authentication middleware protecting certain routes and download any file served by the application. By encoding slashes as %2F in the request URL, an attacker can access protected static files without proper authorization.
Technical details
Echo uses req.URL.RawPath for route matching (router.go lines 798–802), which means /admin%2Fsecret.txt is treated as a single path segment and does not match the /admin/* route pattern. Meanwhile, StaticDirectoryHandler calls url.PathUnescape() before opening files (echo.go lines 559–568), converting %2F back to / and resolving admin/secret.txt on disk. An attacker can craft requests with encoded slashes to bypass route-level authentication middleware and access protected files. No authentication or special privileges are required; the exploit works over the network against any application serving static files from a broader root directory while protecting specific route prefixes with middleware. Patches are available: versions 4.15.3+ (v4 series), 5.2.0+ (v5 series), and v3.3.10 has no patch.
Affected products
- labstack echo v3 <= 3.3.10
- labstack echo/v4 < 4.15.3
- labstack echo/v5 < 5.2.0
Timeline
- 2026-08-25: disclosed: GitHub Advisory published
- 2026-06-14: patched: Patches released: echo v4.15.3 and v5.2.0; v3.x remains unpatched