Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-41321

CVE-2026-41321: Astrojs Cloudflare SSRF Vulnerability

CVE-2026-41321 is an SSRF flaw in Astrojs Cloudflare adapter that allows attackers to bypass domain allowlists via HTTP redirects. This post covers technical details, affected versions, security impact, and mitigation.

Published:

CVE-2026-41321 Overview

CVE-2026-41321 is a Server-Side Request Forgery (SSRF) vulnerability in the @astrojs/cloudflare SSR adapter for Cloudflare Workers. The vulnerability exists in the fetch() call for remote images within packages/integrations/cloudflare/src/utils/image-binding-transform.ts, which uses the default redirect: 'follow' behavior. This allows the Cloudflare Worker to follow HTTP redirects to arbitrary URLs, effectively bypassing the isRemoteAllowed() domain allowlist check that only validates the initial URL.

This vulnerability represents an incomplete fix for the previously disclosed CVE-2025-58179.

Critical Impact

Attackers can bypass domain allowlist restrictions by using HTTP redirects, enabling the Cloudflare Worker to make requests to arbitrary internal or external URLs that should be blocked.

Affected Products

  • @astrojs/cloudflare versions prior to 13.1.10

Discovery Timeline

  • 2026-04-24 - CVE CVE-2026-41321 published to NVD
  • 2026-04-27 - Last updated in NVD database

Technical Details for CVE-2026-41321

Vulnerability Analysis

This SSRF vulnerability (CWE-918) stems from improper handling of HTTP redirects during remote image fetching operations. When the @astrojs/cloudflare adapter processes requests for remote images, it validates the initial URL against a domain allowlist using the isRemoteAllowed() function. However, the subsequent fetch() call does not prevent redirect following, allowing an attacker to specify an allowed domain that redirects to an arbitrary destination.

The attack exploits a fundamental gap between URL validation and request execution. The allowlist check occurs on the original URL, but when the fetch() operation follows redirects automatically, the final destination URL is never validated. This means an attacker controlling an allowed domain (or leveraging an open redirect on an allowed domain) can redirect requests to internal services, cloud metadata endpoints, or other sensitive resources.

Root Cause

The root cause is the use of the default redirect: 'follow' behavior in the fetch() call within image-binding-transform.ts. The isRemoteAllowed() validation function only checks the initial URL provided by the user, creating a Time-of-Check Time-of-Use (TOCTOU) gap where the validated URL differs from the ultimately requested resource.

Attack Vector

An attacker can exploit this vulnerability by providing a URL to an allowed domain that issues an HTTP redirect (301, 302, 307, 308) to an arbitrary target URL. The attack flow involves:

  1. Attacker identifies a domain on the allowlist
  2. Attacker finds or controls a redirect endpoint on that domain
  3. Attacker crafts a request using the allowed domain that redirects to a sensitive internal resource
  4. The Cloudflare Worker follows the redirect and returns data from the restricted destination

The vulnerability requires network access and the attacker must have knowledge of the allowlist configuration and access to a redirect mechanism on an allowed domain.

The vulnerability manifests in the fetch() call within the image binding transform functionality. When processing remote images, the adapter validates the initial URL but fails to restrict redirect following. See the GitHub Security Advisory for complete technical details.

Detection Methods for CVE-2026-41321

Indicators of Compromise

  • Unusual outbound requests from Cloudflare Workers to internal IP addresses or cloud metadata endpoints (e.g., 169.254.169.254)
  • Image fetch requests where the final destination URL differs significantly from the initial request URL
  • Logs showing redirect chains originating from image processing endpoints

Detection Strategies

  • Monitor Cloudflare Worker logs for requests to non-allowlisted destinations that originated from image processing functions
  • Implement network monitoring to detect connections to internal services or metadata endpoints from Worker contexts
  • Review application logs for redirect chains that terminate at unexpected destinations

Monitoring Recommendations

  • Enable detailed logging for all fetch() operations in the image binding transform module
  • Set up alerts for requests to sensitive internal endpoints such as cloud provider metadata services
  • Monitor for unusual patterns in image fetch requests, particularly those involving multiple redirects

How to Mitigate CVE-2026-41321

Immediate Actions Required

  • Upgrade @astrojs/cloudflare to version 13.1.10 or later immediately
  • Audit current allowlist configurations to ensure only trusted domains are included
  • Review logs for any evidence of exploitation attempts

Patch Information

The vulnerability has been fixed in @astrojs/cloudflare version 13.1.10. The fix properly handles redirect behavior to ensure that all URLs in a redirect chain are validated against the domain allowlist. Organizations should update their dependencies as soon as possible.

For detailed patch information, refer to the GitHub Security Advisory.

Workarounds

  • If upgrading is not immediately possible, restrict the domain allowlist to only absolutely necessary domains
  • Remove any domains from the allowlist that may have open redirect vulnerabilities
  • Implement additional network-level controls to prevent Workers from accessing sensitive internal resources
  • Consider temporarily disabling remote image processing functionality until the patch can be applied
bash
# Update @astrojs/cloudflare to patched version
npm update @astrojs/cloudflare@13.1.10

# Or using yarn
yarn upgrade @astrojs/cloudflare@13.1.10

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.