Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-58179

CVE-2025-58179: Astro Cloudflare Adapter SSRF Vulnerability

CVE-2025-58179 is an SSRF vulnerability in Astro's @astrojs/cloudflare adapter that allows attackers to bypass domain restrictions and serve unauthorized third-party content. This guide covers technical details, affected versions, and mitigations.

Published:

CVE-2025-58179 Overview

CVE-2025-58179 is a Server-Side Request Forgery (SSRF) vulnerability affecting the @astrojs/cloudflare adapter for the Astro web framework. Versions 11.0.3 through 12.6.5 are impacted when the adapter runs with output: 'server' and the default imageService: 'compile' configuration. The generated image optimization endpoint fails to validate the URLs it receives. Attackers can bypass third-party domain restrictions and serve arbitrary remote content through the vulnerable origin. The maintainers resolved the issue in version 12.6.6. The vulnerability is tracked under CWE-918: Server-Side Request Forgery.

Critical Impact

An unauthenticated remote attacker can proxy arbitrary third-party content through an affected Astro site's image endpoint, enabling content spoofing, phishing lures, and abuse of the origin's trust and bandwidth.

Affected Products

  • Astro @astrojs/cloudflare adapter versions 11.0.3 through 12.6.5
  • Astro applications deployed to Cloudflare with output: 'server'
  • Astro applications using the default imageService: 'compile' setting

Discovery Timeline

  • 2025-09-05 - CVE-2025-58179 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-58179

Vulnerability Analysis

The @astrojs/cloudflare adapter generates an image optimization endpoint when Astro is built for server-side rendering on Cloudflare. In affected releases, that endpoint accepts a URL parameter and fetches the referenced resource without verifying the host against the project's configured image.domains or image.remotePatterns allowlist. An attacker constructs a request that passes an arbitrary external URL to the endpoint, and the origin returns the fetched bytes to the client.

The result is a two-fold problem. First, the vulnerable site becomes an open image proxy that can serve attacker-controlled content under a trusted origin, aiding phishing and brand abuse. Second, the outbound fetch occurs from the Cloudflare Worker's network position, which may reach internal metadata or partner services depending on network configuration.

Root Cause

The endpoint at packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts did not import or invoke Astro's remote URL allowlist helpers. The endpoint trusted the incoming URL parameter directly, so any request formatted as a valid image fetch bypassed the framework's third-party domain policy.

Attack Vector

Exploitation requires only network access to the deployed Astro site. An attacker sends a crafted HTTP request to the built-in image optimization endpoint with a href (or equivalent) query parameter pointing to any external URL. No authentication or user interaction is required.

typescript
// Patch excerpt from packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts
+// @ts-expect-error
+import { imageConfig } from 'astro:assets';
+import { isRemotePath } from '@astrojs/internal-helpers/path';
 import type { APIRoute } from 'astro';
+import { isRemoteAllowed } from 'astro/assets/utils';
 
 export const prerender = false;
// Source: https://github.com/withastro/astro/commit/9ecf3598e2b29dd74614328fde3047ea90e67252

The fix imports imageConfig, isRemotePath, and isRemoteAllowed so the endpoint can validate that any remote URL matches the developer-configured allowlist before performing the fetch.

Detection Methods for CVE-2025-58179

Indicators of Compromise

  • Requests to the Cloudflare image endpoint (for example /_image) containing href values pointing to domains outside the project's configured image.domains or image.remotePatterns.
  • Outbound fetches from the Cloudflare Worker to hosts never referenced by the application's source code.
  • Unusual response sizes or MIME types returned from the image endpoint that do not match the site's own image assets.

Detection Strategies

  • Inspect Cloudflare Worker request logs and match href query parameters against the application's allowlist of image origins.
  • Review Astro build output to confirm which package version of @astrojs/cloudflare is deployed, flagging any release between 11.0.3 and 12.6.5.
  • Correlate spikes in image endpoint traffic with referrer or User-Agent values that deviate from normal client traffic.

Monitoring Recommendations

  • Enable Cloudflare Logpush or equivalent request logging for the routes served by the Astro Worker.
  • Alert on repeated requests to the image endpoint that carry fully qualified external URLs in query parameters.
  • Track egress destinations from the Worker and flag first-seen third-party domains for review.

How to Mitigate CVE-2025-58179

Immediate Actions Required

  • Upgrade @astrojs/cloudflare to version 12.6.6 or later and redeploy the affected Worker.
  • Audit deployed Astro sites for the vulnerable configuration combination of output: 'server' and imageService: 'compile'.
  • Review recent image endpoint traffic for signs of abuse and preserve logs for incident response.

Patch Information

The fix is delivered in @astrojs/cloudflare version 12.6.6. The upstream commit 9ecf3598e2b29dd74614328fde3047ea90e67252 adds allowlist enforcement inside the image endpoint using isRemoteAllowed and isRemotePath. Full remediation details are documented in the GitHub Security Advisory GHSA-qpr4-c339-7vq8.

Workarounds

  • Switch the Astro configuration to a non-vulnerable image service such as imageService: 'passthrough' until the upgrade is applied.
  • Place a Cloudflare WAF or Worker rule in front of the image endpoint that rejects requests whose URL parameters reference domains outside the approved allowlist.
  • Disable the image optimization endpoint entirely if it is not required by the application.
bash
# Upgrade the vulnerable adapter to the patched release
npm install @astrojs/cloudflare@^12.6.6

# Verify the installed version
npm ls @astrojs/cloudflare

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.