{"vuln_id":"GHSA-g3c2-rjq2-c763","aliases":["CVE-2026-102657"],"description":"esm.sh: web.NewHandler allows arbitrary file read via encoded dot-segment path traversal","published_at":"2026-11-09T22:03:29Z","modified_at":"2026-11-23T20:30:12.663531Z","first_seen_at":"2026-11-23T21:06:31.531023Z","severity":"high","severity_source":"native","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","cwe":["CWE-22"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-g3c2-rjq2-c763"},"matched_alias":null,"items":[{"id":16652,"source":{"id":"osv","name":"OSV.dev"},"title":"GO-2026-6954: esm.sh: web.NewHandler allows arbitrary file read via encoded dot-segment path traversal in github.com/esm-dev/esm.sh","summary":"esm.sh: web.NewHandler allows arbitrary file read via encoded dot-segment path traversal in github.com/esm-dev/esm.sh\n\nAffected: Go:github.com/esm-dev/esm.sh\n\nFixed in: 0.2.0\n\nReferences:\nhttps://github.com/esm-dev/esm.sh/security/advisories/GHSA-g3c2-rjq2-c763\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-102657\nhttps://github.com/esm-dev/esm.sh/commit/468b6b2a4b4dfec334cf6b33b01fcd4e5cd93bed\nhttps://github.com/esm-dev/esm.sh/commit/fc3b345e73aeaa0b7a05b6f27d91c05fdf5f9b53\nhttps://github.com/esm-dev/esm.sh/pull/1376\nhttps://github.com/esm-dev/esm.sh/releases/tag/v0.2.0\nhttps://github.com/esm-dev/esm.sh/releases/tag/v137_7","url":"https://osv.dev/vulnerability/GO-2026-6954","published_at":"2026-11-23T20:02:42Z","updated_at":"2026-11-23T20:30:12.663531Z","fetched_at":"2026-11-23T21:06:31.109645Z","severity":"high","cvss_score":7.5,"epss":0.03957,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"github.com/esm-dev/esm.sh","vuln_id":"CVE-2026-102657","vuln_ids":["CVE-2026-102657","GHSA-G3C2-RJQ2-C763","GO-2026-6954"],"tags":["osv","go","fix-available"],"cluster_id":14731,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/16652","html":"https://vulnwatch.ve1ve2.com/item/16652"}},{"id":16569,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-g3c2-rjq2-c763: esm.sh: web.NewHandler allows arbitrary file read via encoded dot-segment path traversal","summary":"esm.sh: web.NewHandler allows arbitrary file read via encoded dot-segment path traversal\n\n### Summary\n\nThe 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.\n\n### Details\n\n`web/README.md:34-40` documents a network-facing setup:\n\n```go\nhttp.Handle(\"GET /\", web.NewHandler(web.Config{\n  AppDir: \"/path/to/webapp\",\n  Fallback: \"/index.html\",\n  Dev: false,\n}))\nlog.Fatal(http.ListenAndServe(\":8080\", nil))\n```\n\nIn `web/handler.go:62-75`, the handler takes `r.URL.Path` and joins it directly with `s.config.AppDir`:\n\n```go\npathname := r.URL.Path\nfilename := filepath.Join(s.config.AppDir, pathname)\nfi, err := os.Lstat(filename)\n```\n\nLater the same resolved filename is opened and copied to the response in `web/handler.go:150-166` for non-HTML/static files. There is no `filepath.IsLocal`, cleaned-relative-path, absolute-root prefix, or symlink-aware containment check before opening the file.\n\nA plain `/../secret.txt` path is redirected by Go's `ServeMux`, but an encoded path such as `/%2e%2e/secret.txt` is decoded into `r.URL.Path == \"/../secret.txt\"` and reaches the handler. On Linux, `filepath.Join(\"/tmp/root/app\", \"/../secret.txt\")` resolves to `/tmp/root/secret.txt`, outside the configured app directory.\n\nSource-to-sink chain:\n\n```text\nUnauthenticated HTTP request path containing URL-encoded dot-segments\n-> net/http decodes path into r.URL.Path\n-> documented ServeMux setup passes encoded dot-segment path to web.NewHandler\n-> web/handler.go joins Config.AppDir with r.URL.Path\n-> os.Lstat/os.Open operate on the escaped path\n-> io.Copy returns file contents to the attacker\n```\n\nFalse-positive checks performed:\n- Plain dot-segment paths are redirected by `http.ServeMux`, but encoded dot-segments are not blocked and reach the handler.\n- The PoC uses the documented `http.Handle(\"GET /\", web.NewHandler(...))` setup, not a custom bypass of ServeMux.\n- A control request for `/secret.txt` does not read the outside file; the disclosure requires encoded traversal segments.\n- The issue is independent of `Dev`/HMR; it reproduces with `Dev: false`.\n- The root cause appears in other handler paths that join app paths, but the static file read path is sufficient to prove arbitrary file disclosure.\n\nCandidate score: 18/18 under the local audit scoring rubric. The handler is documented for network-facing use, the attacker directly controls the request path, the path reaches `os.Open`, file disclosure was reproduced locally, and no root containment mitigation is present.\n\n### PoC\n\nThis safe local proof creates an application directory and a sibling secret file outside it, registers the handler exactly as documented, and requests the\n\nAffected: Go:github.com/esm-dev/esm.sh/web\n\nFixed in: 0.2.0\n\nReferences:\nhttps://github.com/esm-dev/esm.sh/security/advisories/GHSA-g3c2-rjq2-c763\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-102657\nhttps://github.com/esm-dev/esm.sh/pull/1376\nhttps://github.com/esm-dev/esm.sh/commit/468b6b2a4b4dfec334cf6b33b01fcd4e5cd93bed\nhttps://github.com/esm-dev/esm.sh/commit/fc3b345e73aeaa0b7a05b6f27d91c05fdf5f9b53\nhttps://github.com/esm-dev/esm.sh\nhttps://github.com/esm-dev/esm.sh/releases/tag/v0.2.0\nhttps://github.com/esm-dev/esm.sh/releases/tag/v137_7","url":"https://osv.dev/vulnerability/GHSA-g3c2-rjq2-c763","published_at":"2026-11-09T22:03:29Z","updated_at":"2026-11-09T22:15:03.912082Z","fetched_at":"2026-11-23T21:06:31.109571Z","severity":"high","cvss_score":7.5,"epss":0.03957,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"github.com/esm-dev/esm.sh/web","vuln_id":"CVE-2026-102657","vuln_ids":["CVE-2026-102657","GHSA-G3C2-RJQ2-C763"],"tags":["osv","go","fix-available"],"cluster_id":14730,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/16569","html":"https://vulnwatch.ve1ve2.com/item/16569"}}]}