/

CVE-2026-27730

Severity:

HIGH RISK

(7.5)

SSRF in esm.sh /http(s) Fetch Route

CVE-2026-27730

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized access to internal services via SSRF

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

esm.sh's /http(s) fetch route contains a server-side request forgery (SSRF) flaw that allows external users to coerce the CDN backend into making HTTP(S) requests to internal services.

Because localhost and internal access controls rely only on hostname string checks, they can be bypassed via DNS alias domains, enabling access to services not directly exposed to the internet.

Affected context

This vulnerability affects deployments of esm.sh up to and including version 137 that expose the /http(s) fetch route to untrusted or public clients.

The issue manifests when esm.sh is allowed to resolve and connect to arbitrary hostnames provided by users, while the protection against localhost or internal destinations is implemented using simple hostname string filtering rather than network- or IP-aware validation.

Environments where the esm.sh server has network visibility into internal APIs, metadata services, admin panels, or other non-public endpoints are particularly at risk.

Exploit preconditions

  • Attack surface: Public or externally reachable /http(s) fetch endpoint on esm.sh
  • Required access: Ability to issue HTTP requests to the esm.sh instance (no privileged authentication assumed)
  • Trigger point: Supplying a crafted URL whose hostname resolves to an internal or localhost IP, but whose literal hostname string bypasses the basic blocklist
  • Why exploitation is possible: The access control logic checks only the textual hostname against disallowed patterns (e.g., localhost, 127.0.0.1) without resolving the hostname and validating the resulting IP and network, allowing DNS aliases to internal addresses

Why this happens

The core bug is an incomplete and trust-without-verification pattern for outbound requests initiated on behalf of users.

The /http(s) route accepts user-supplied URLs and attempts to prevent internal access by filtering hostnames using simple string comparisons.

This maps to CWE-918: Server-Side Request Forgery (SSRF), where a server-side component performs network requests based on untrusted input without robust target validation.

Because the system does not resolve the hostname and enforce restrictions on the actual IP address, attackers can leverage DNS aliases or crafted domain names that appear benign in string form but ultimately route to internal resources.

Potential impact

  • Unauthorized HTTP(S) access to internal services reachable from the esm.sh server
  • Interaction with internal admin panels, monitoring dashboards, or APIs not exposed to the public internet
  • Access to instance or cloud provider metadata endpoints, which may lead to credential or token disclosure
  • Use of esm.sh as a network pivot to map internal services, ports, and response behaviors
  • Potential data exfiltration from internal APIs, subject to response visibility to the attacker

General mitigation guidance

Effective mitigation focuses on hardening how user-controlled URLs are handled and reducing the network trust zone of the service:

  • Enforce IP- and network-based deny lists: resolve hostnames and block requests to localhost ranges, private IP ranges, link-local, and metadata service addresses, rather than relying on string checks.
  • Consider an allowlist model: restrict outbound requests to a curated set of domains or IP ranges that are known to be safe for proxying.
  • Isolate network access: run the esm.sh server in a network segment with minimal access to sensitive internal services and metadata endpoints.
  • Normalize and strictly validate URLs: ensure consistent parsing, reject ambiguous or malformed URLs, and avoid following redirects into internal networks.
  • Apply least-privilege to outbound connectivity: limit the protocols, ports, and destination ranges available to the fetch component.

How teams detect issues like this

High-level detection can combine code-centric review with operational monitoring:

  • Static analysis and code review to flag any code paths where user-supplied URLs are fetched server-side, especially where filtering is based on hostname strings instead of resolved IPs or CIDR checks.
  • Security review of proxy or fetch endpoints to ensure they do not provide arbitrary open proxy capabilities or direct access into private networks.
  • Logging and monitoring of outbound requests initiated via the /http(s) route, including destination hostnames, resolved IP addresses, and unusual patterns such as access to internal IP ranges.
  • Network-level controls and IDS/IPS rules that alert on unexpected requests from the esm.sh infrastructure to internal address spaces or metadata services.

Sources

SourceLink
github.comgithub.com/esm-dev/esm.sh/security/advisories/GHSA-p2v6-84h2-5x4r

Frequently asked

questions

Yes. Any external client that can reach the esm.sh /http(s) route can potentially exploit the SSRF, assuming the backend has network access to internal targets.

Not necessarily. If the /http(s) endpoint is exposed without strict authentication or domain restrictions, anonymous or low-privilege users can craft URLs that route to internal services via DNS aliases.

The most robust approach is to stop treating the fetch route as an arbitrary proxy and either adopt a strict allowlist of external domains or perform IP-based validation that blocks localhost, private, and metadata ranges after DNS resolution and redirect handling.

Treat any server-side HTTP(S) request based on user input as a potential SSRF sink, enforce network and IP-aware validation, minimize server access to sensitive internal networks, and include SSRF-focused checks in security reviews and automated testing pipelines.

Find out what's already
exploitable in your codebase.