5.3medium
Echo has a Windows path traversal via backslash in middleware.Static default filesystem
- Severity
- 5.3medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.45% (higher than 41% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-pgvm-wxw2-hrv9GO-2026-4502
Description
Echo is a Go web framework. In versions 5.0.0 through 5.0.2 on Windows, Echo’s `middleware.Static` using the default filesystem allows path traversal via backslashes, enabling unauthenticated remote file read outside the static root. In `middleware/static.go`, the requested path is unescaped and normalized with `path.Clean` (URL semantics). `path.Clean` does not treat `\` as a path separator, so `..\` sequences remain in the cleaned path. The resulting path is then passed to `currentFS.Open(...)`. When the filesystem is left at the default (nil), Echo uses `defaultFS` which calls `os.Open` (`echo.go:792`). On Windows, `os.Open` treats `\` as a path separator and resolves `..\`, allowing traversal outside the static root. Version 5.0.3 fixes the issue.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| labstack echo | >= 5.0.0, < 5.0.3, from 5.0.0 before 5.0.3 | CVE List, NVD |
| github.com/labstack/echo/v5 (Go) | from 5.0.0 before 5.0.3 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
Echo is a Go web framework. In versions 5.0.0 through 5.0.2 on Windows, Echo’s `middleware.Static` using the default filesystem allows path traversal via backslashes, enabling unauthenticated remote file read outside the static root. In `middleware/static.go`, the requested path is unescaped and normalized with `path.Clean` (URL semantics). `path.Clean` does not treat `\` as a path separator, so `..\` sequences remain in the cleaned path. The resulting path is then passed to `currentFS.Open(...)`. When the filesystem is left at the default (nil), Echo uses `defaultFS` which calls `os.Open` (`echo.go:792`). On Windows, `os.Open` treats `\` as a path separator and resolves `..\`, allowing traversal outside the static root. Version 5.0.3 fixes the issue.
GitHub Advisory Database
Summary
On Windows, Echo’s middleware.Static using the default filesystem allows path traversal via backslashes, enabling
unauthenticated remote file read outside the static root.
Details
In middleware/static.go, the requested path is unescaped and normalized with path.Clean (URL semantics).
path.Clean does not treat \ as a path separator, so ..\ sequences remain in the cleaned path. The resulting
path is then passed to currentFS.Open(...). When the filesystem is left at the default (nil), Echo uses defaultFS
which calls os.Open (echo.go:792). On Windows, os.Open treats \ as a path separator and resolves ..\,
allowing traversal outside the static root.
Relevant code:
middleware/static.go(path unescape +path.Clean+currentFS.Open)echo.godefaultFS.Open→os.Open
This is the same class as CVE-2020-36565 (fixed in v4 by switching to OS-aware cleaning), but in v5 the path.Clean
- defaultFS combination reintroduces the Windows backslash traversal.
PoC
Windows only.
Sample code (main.go):
package main
import (
"log"
"net/http"
"github.com/labstack/echo/v5"
"github.com/labstack/echo/v5/middleware"
)
func main() {
e := echo.New()
// Important: use middleware.Static with default filesystem (nil)
e.Use(middleware.Static("public"))
e.GET("/healthz", func(c *echo.Context) error {
return c.String(http.StatusOK, "ok")
})
addr := ":1323"
log.Printf("listening on %s", addr)
if err := e.Start(addr); err != nil && err != http.ErrServerClosed {
log.Fatal(err)
}
}
Static file:
public/index.html
(content can be any HTML)
Run: go run .
Verify:
curl http://localhost:1323/index.html curl --path-as-is "http://localhost:1323/..%5c..%5cWindows%5cSystem32%5cdrivers%5cetc%5chosts" Expected: 404
Impact
Path traversal leading to arbitrary file read outside the static root. Any unauthenticated remote user can
read local files that the Echo process has access to on Windows, if middleware.Static is used with the default
filesystem.
Go Vulnerability Database
Echo has a Windows path traversal via backslash in middleware.Static default filesystem in github.com/labstack/echo/v5
NVD (es)
Echo es un marco web de Go. En las versiones 5.0.0 a 5.0.2 en Windows, el `middleware.Static` de Echo que utiliza el sistema de archivos predeterminado permite recorrer rutas mediante barras invertidas, lo que permite la lectura de archivos remotos no autenticados fuera de la raíz estática. En `middleware/static.go`, la ruta solicitada no se escapa y se normaliza con `path.Clean` (semántica de URL). `path.Clean` no trata `\` como un separador de ruta, por lo que las secuencias `..\` permanecen en la ruta limpia. La ruta resultante se pasa entonces a `currentFS.Open(...)`. Cuando el sistema de archivos se deja en el valor predeterminado (nil), Echo utiliza `defaultFS`, que llama a `os.Open` (`echo.go:792`). En Windows, `os.Open` trata `\` como un separador de ruta y resuelve `..\`, lo que permite el recorrido fuera de la raíz estática. La versión 5.0.3 corrige el problema.
References
| https://github.com/labstack/echo/security/advisories/GHSA-pgvm-wxw2-hrv9 | advisory, exploit, vendor-advisory, web | |
| https://github.com/labstack/echo/pull/2891 | fix, issue-tracking, patch, web | |
| https://github.com/labstack/echo/commit/b1d443086ea27cf51345ec72a71e9b7e9d9ce5f1 | fix, patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-25766 | advisory | |
| https://github.com/labstack/echo | package | |
| https://pkg.go.dev/vuln/GO-2026-4502 | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-25766 changed 2026-02-19 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-pgvm-wxw2-hrv9 changed 2026-02-27 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-4502 changed 2026-02-26 | CC-BY-4.0 |
| NVD | CVE-2026-25766 changed 2026-06-17 | Public domain |