Vulnerability · Published Sep 17, 2025 · Assigned by GitHub_M
CVE-2025-59342esm.sh writes arbitrary files via path traversal in `X-Zone-Id` header
Medium 5.5
In plain English
A medium-severity security flaw in esm.sh from esm-dev. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 3.2% (higher than 88% of all known vulnerabilities). Ready-made attack tooling exists: Nuclei, public proof-of-concept code. Fixed versions are available - upgrade the affected package.
Official description
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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Go | github.com/esm-dev/esm.sh | 136.1 | GHSA-g2h5-cvvr-7gmw |
| Go | github.com/esm-dev/esm.sh | no fix listed | GO-2025-3967 |
Affected products (as reported)
Weakness: CWE-24 · 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
References
- https://github.com/esm-dev/esm.sh/security/advisories/GHSA-g2h5-cvvr-7gmw x_refsource_CONFIRM
- https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151 x_refsource_MISC
- https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L116 x_refsource_MISC
- https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L411 x_refsource_MISC