{"id":"CVE-2025-59342","published":"2025-09-17T17:59:34Z","modified":"2026-01-14T15:52:09Z","title":"esm.sh writes arbitrary files via path traversal in `X-Zone-Id` header","vendor":"esm-dev","product":"esm.sh","tier":"tail","description":{"text":"esm.sh is a nobuild content delivery network(CDN) for modern web development. In 136 and earlier, a path-traversal flaw in the handling of the X-Zone-Id HTTP header allows an attacker to cause the application to write files outside the intended storage location. The header value is used to build a filesystem path but is not properly canonicalized or restricted to the application’s storage base directory. As a result, supplying ../ sequences in X-Zone-Id causes files to be written to arbitrary directories. Version 136.1 contains a patch.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.5,"severity":"MEDIUM","version":"4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.03281,"percentile":0.88759,"provenance":"source"},"cwes":[{"id":"CWE-24","name":"Path Traversal: '../filedir'"}],"references":[{"url":"https://github.com/esm-dev/esm.sh/security/advisories/GHSA-g2h5-cvvr-7gmw","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151","tags":["x_refsource_MISC"]},{"url":"https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L116","tags":["x_refsource_MISC"]},{"url":"https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L411","tags":["x_refsource_MISC"]}],"priority":{"score":26.6,"factors":[{"name":"EPSS percentile","points":17.75},{"name":"Public exploit code","points":5.0},{"name":"CVSS severity","points":3.85}]},"exploitSources":{"exploitdb":{"count":1,"earliest":"2025-12-16"},"pocGithub":{"count":1,"skipped":0,"earliest":"2025-09-18","earliestUrl":"https://github.com/byteReaper77/CVE-2025-59342","repos":[{"name":"byteReaper77/CVE-2025-59342","url":"https://github.com/byteReaper77/CVE-2025-59342","stars":1,"created":"2025-09-18"}]},"nuclei":[{"id":"CVE-2025-59342","name":"esm.sh <= v136 - Arbitrary File Write via Path Traversal","severity":"medium","path":"http/cves/2025/CVE-2025-59342.yaml","url":"https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2025/CVE-2025-59342.yaml"}],"first":{"date":"2025-09-18","source":"PoC-in-GitHub","url":"https://github.com/byteReaper77/CVE-2025-59342"},"provenance":"source"},"vendorSlug":"esm-dev","affectedVersions":[{"vendor":"esm-dev","product":"esm.sh","versions":["<= 136"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"partial","timestamp":"2025-09-17T18:19:55.260782Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"Go","package":"github.com/esm-dev/esm.sh","vulnerableRanges":["<136.1","all versions"],"patched":["136.1"],"from":["GHSA-g2h5-cvvr-7gmw","GO-2025-3967"],"provenance":"source"}],"summary":{"text":"The esm.sh CDN has a path-traversal flaw in how it handles the X-Zone-Id HTTP header, which is used to build a filesystem path without being canonicalized or restricted to the application's storage base directory. An attacker with network access and no authentication or user interaction can send ../ sequences in that header to cause the application to write files to arbitrary directories.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T06:33:30Z"},"euvd":{"id":"EUVD-2025-29764","exploited":false,"provenance":"source"},"exploits":[{"id":52461,"url":"https://www.exploit-db.com/exploits/52461","title":"esm-dev 136 - Path Traversal","date":"2025-12-16","verified":false,"provenance":"source"}],"lineage":{"familyId":"fam-esm-dev-esm-sh-cve-2025-59341","parents":[{"from":"CVE-2025-59341","to":"CVE-2025-59342","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["server/router.go"],"commits":["https://github.com/esm-dev/esm.sh/commit/492de92850dd4d350c8b299af541f87541e58a45","https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151"],"basis":"shared function","functions":["esmRouter"]}]}],"children":[{"from":"CVE-2025-59342","to":"CVE-2025-50180","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["server/router.go"],"commits":["https://github.com/esm-dev/esm.sh/commit/0593516c4cfab49ad3b4900416a8432ff2e23eb0","https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151"],"basis":"shared function","functions":["esmRouter"]}]},{"from":"CVE-2025-59342","to":"CVE-2025-65026","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["server/router.go"],"commits":["https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151","https://github.com/esm-dev/esm.sh/commit/87d2f6497574bf4448641a5527a3ac2beba5fd6c"],"basis":"shared function","functions":["esmRouter"]}]},{"from":"CVE-2025-59342","to":"CVE-2026-27730","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["server/router.go"],"commits":["https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151","https://github.com/esm-dev/esm.sh/commit/0593516c4cfab49ad3b4900416a8432ff2e23eb0"],"basis":"shared function","functions":["esmRouter"]}]}]}}