Summary
A server-side request forgery (SSRF) vulnerability in esm.sh v136 allows attackers to make the service issue HTTP requests to arbitrary internal or external URLs and return the full response.
When an attacker can control where esm.sh connects on the backend, they may be able to read sensitive data from internal services that are not otherwise exposed to the public internet.
Affected context
This vulnerability affects deployments that rely on esm.sh v136 as a no-build CDN to fetch and transform remote resources on behalf of users.
The issue arises when user-controlled input is used to construct backend HTTP requests without sufficient validation or restriction of target hosts, protocols, or paths.
It becomes particularly risky in environments where the esm.sh service has network access to internal endpoints (e.g., cloud metadata services, internal APIs, management panels) that are not directly reachable from the internet.
Exploit preconditions
- Attack surface: Public HTTP endpoints exposed by esm.sh that accept user-controlled URLs or resource identifiers.
- Required access: Network access to the esm.sh service (typically anonymous web access; no special authentication needed if the service is public).
- Trigger point: Submitting crafted requests that cause esm.sh to perform server-side HTTP requests to attacker-chosen destinations.
- Why exploitation is possible: The backend logic trusts user-supplied values when forming outbound requests and does not adequately restrict internal IP ranges, hostnames, or protocols, allowing the response body from internal services to be relayed back to the attacker.
Why this happens
The root cause aligns with CWE-918: Server-Side Request Forgery (SSRF), where a server makes unintended network requests due to unvalidated user input.
In this case, esm.sh functions as an HTTP client that fetches resources on behalf of users.
Because the implementation uses attacker-influenced data to construct outbound requests without enforcing strict allowlists, network boundaries, or protocol constraints, the service can be coerced into connecting to internal services and returning their responses.
The insecure pattern is treating user input as a trusted URL/endpoint, coupled with backend network permissions that are broader than what users should be able to reach.
Potential impact
- Access to sensitive data from internal HTTP services (e.g., configuration endpoints, internal dashboards, or admin panels).
- Discovery of internal network structure and reachable hosts through response content and error messages.
- Potential access to cloud provider metadata services, which may expose credentials or configuration details.
- Facilitation of further attacks such as internal service probing or chaining with other vulnerabilities (e.g., misconfigured admin interfaces).
- Increased risk of lateral movement within the hosting environment if sensitive tokens, keys, or internal URLs are exposed.
General mitigation guidance
Mitigation focuses on tightly controlling how user input influences outbound network requests and limiting the network reach of the service:
- Enforce strict allowlists of permitted domains, hostnames, or registries that the CDN is allowed to contact, rejecting all other destinations by default.
- Block or sanitize access to internal IP ranges (e.g., RFC1918 addresses, link-local, loopback, metadata IPs) and internal hostnames that should never be reachable from user-controlled requests.
- Normalize and validate URLs before use, ensuring that protocol, hostname, and port are explicitly checked and cannot be bypassed via redirects, DNS rebinding, or URL parsing quirks.
- Apply least-privilege networking by segmenting the service onto networks where internal-sensitive resources are not accessible, or by using firewall rules and egress filters to constrain outbound traffic.
- Where possible, separate metadata/management networks from application-serving networks to reduce the blast radius of any SSRF-like behavior.
How teams detect issues like this
Detection typically involves a mix of code-level review and runtime monitoring:
- Static analysis and code review: Look for code paths where user input is concatenated into URLs or request targets for HTTP clients; flag use of generic URL fetchers without host validation or allowlists.
- Security testing: Incorporate SSRF-focused tests into CI pipelines, using automated tools or test suites that attempt to reach internal IP ranges and well-known metadata endpoints through user-controlled parameters.
- Network monitoring: Inspect outbound traffic from the esm.sh infrastructure for unusual targets (e.g., internal IPs, cloud metadata addresses, unexpected ports) and configure alerts for suspicious patterns.
- Policy enforcement: Use infrastructure-level controls, such as egress firewalls or service mesh policies, that disallow outbound traffic to non-approved destinations regardless of application behavior.

