{"id":"CVE-2026-25766","aliases":["CVE-2026-25766","GHSA-pgvm-wxw2-hrv9","GO-2026-4502"],"related":[],"kind":"vulnerability","state":"published","title":"Echo has a Windows path traversal via backslash in middleware.Static default filesystem","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Summary\nOn Windows, Echo’s `middleware.Static` using the default filesystem allows path traversal via backslashes, enabling\nunauthenticated remote file read outside the static root.\n\n### Details  \n\n  In `middleware/static.go`, the requested path is unescaped and normalized with `path.Clean` (URL semantics).\n  `path.Clean` does **not** treat `\\` as a path separator, so `..\\` sequences remain in the cleaned path. The resulting\n  path is then passed to `currentFS.Open(...)`. When the filesystem is left at the default (nil), Echo uses `defaultFS`\n  which calls `os.Open` (`echo.go:792`). On Windows, `os.Open` treats `\\` as a path separator and resolves `..\\`,\n  allowing traversal outside the static root.\n\n  Relevant code:\n  - `middleware/static.go` (path unescape + `path.Clean` + `currentFS.Open`)\n  - `echo.go` `defaultFS.Open` → `os.Open`\n\n  This is the same class as CVE-2020-36565 (fixed in v4 by switching to OS-aware cleaning), but in v5 the `path.Clean`\n  + defaultFS combination reintroduces the Windows backslash traversal.\n\n\n### PoC\n Windows only.\n\n  **Sample code (main.go):**\n  ```go\n  package main\n\n  import (\n        \"log\"\n        \"net/http\"\n\n        \"github.com/labstack/echo/v5\"\n        \"github.com/labstack/echo/v5/middleware\"\n  )\n\n  func main() {\n        e := echo.New()\n\n        // Important: use middleware.Static with default filesystem (nil)\n        e.Use(middleware.Static(\"public\"))\n\n        e.GET(\"/healthz\", func(c *echo.Context) error {\n                return c.String(http.StatusOK, \"ok\")\n        })\n\n        addr := \":1323\"\n        log.Printf(\"listening on %s\", addr)\n        if err := e.Start(addr); err != nil && err != http.ErrServerClosed {\n                log.Fatal(err)\n        }\n  }\n ```\n  Static file:\n\n  public/index.html\n\n  (content can be any HTML)\n\n  **Run:**\n  go run .\n\n  **Verify:**\n\n  curl http://localhost:1323/index.html\n  curl --path-as-is \"http://localhost:1323/..%5c..%5cWindows%5cSystem32%5cdrivers%5cetc%5chosts\"\n  Expected: 404  \n\n  **Screenshot:**\n<img width=\"884\" height=\"689\" alt=\"image\" src=\"https://github.com/user-attachments/assets/acb14d70-2a43-47c1-8927-2f3da491a853\" />\n<img width=\"1022\" height=\"162\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f2b92aa2-541e-461d-81a2-8a5907d7a447\" />\n\n\n\n  ### Impact\n  Path traversal leading to arbitrary file read outside the static root. Any unauthenticated remote user can\n  read local files that the Echo process has access to on Windows, if `middleware.Static` is used with the default\n  filesystem.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Echo has a Windows path traversal via backslash in middleware.Static default filesystem in github.com/labstack/echo/v5","format":"markdown","source":"go"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-02-17T18:53:58.000Z","modified":"2026-06-17T10:25:11.797Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":">= 5.0.0, < 5.0.3","status":"affected"}],"vendor":"labstack","product":"echo","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"5.0.0","status":"affected","fixed":"5.0.3"}],"ecosystem":"Go","package":"github.com/labstack/echo/v5","purl":"pkg:golang/github.com/labstack/echo/v5","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"5.0.0","status":"affected","fixed":"5.0.3"}],"ecosystem":"Go","package":"github.com/labstack/echo/v5","purl":"pkg:golang/github.com/labstack/echo/v5","source":"go"},{"ranges":[{"status":"affected","introduced":"5.0.0","fixed":"5.0.3"}],"vendor":"labstack","product":"echo","cpe":"cpe:2.3:a:labstack:echo:*:*:*:*:*:go:*:*","source":"nvd"}],"references":[{"url":"https://github.com/labstack/echo/security/advisories/GHSA-pgvm-wxw2-hrv9","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/labstack/echo/pull/2891","tags":["fix","issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/labstack/echo/commit/b1d443086ea27cf51345ec72a71e9b7e9d9ce5f1","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25766","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/labstack/echo","tags":["package"],"sources":["ghsa"]},{"url":"https://pkg.go.dev/vuln/GO-2026-4502","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-02-19T19:45:33.220Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-25766","url":"https://www.cve.org/CVERecord?id=CVE-2026-25766","licence":"CVE Terms of Use","modified":"2026-02-19T19:46:01.829Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-pgvm-wxw2-hrv9","url":"https://github.com/advisories/GHSA-pgvm-wxw2-hrv9","licence":"CC-BY-4.0","modified":"2026-02-27T22:07:05.000Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4502","url":"https://pkg.go.dev/vuln/GO-2026-4502","licence":"CC-BY-4.0","modified":"2026-02-26T18:55:57.633Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-25766","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25766","licence":"Public domain","modified":"2026-06-17T10:25:11.797Z"}],"updatedAt":"2026-11-25T22:59:14.201Z","epss":{"score":0.00453,"percentile":0.41035,"date":"2026-12-01T12:00:22.000Z"}}