Advisories for Golang/Github.com/Esm-Dev/Esm.sh/Web package

2026

esm.sh: web.NewHandler allows arbitrary file read via encoded dot-segment path traversal

The documented web.NewHandler static file server can read files outside Config.AppDir when the request path contains URL-encoded dot-segments such as %2e%2e. Go's ServeMux redirects plain /../ paths, but it passes encoded dot-segments to the handler after decoding r.URL.Path. The handler then calls filepath.Join(s.config.AppDir, r.URL.Path) without checking that the result remains under AppDir, allowing unauthenticated arbitrary file reads with the server process privileges.