{"id":"CVE-2026-55791","aliases":["CVE-2026-55791","GHSA-c55v-343g-5xff"],"related":[],"kind":"vulnerability","state":"published","title":"Craft CMS: Blind SSRF and Arbitrary JavaScript Injection via Host Header Poisoning in actionResourceJs","summary":"Craft CMS is a content management system (CMS). Versions 4.0.0-RC1 and above, prior to 4.18.0 and 5.0.0-RC1, and above, prior to 5.10.0, are vulnerable to Server-Side Request Forgery (SSRF) and Arbitrary JavaScript Injection through the /actions/app/resource-js endpoint. By exploiting the default permissive trustedHosts configuration, an attacker can poison the Host or X-Forwarded-Host header to manipulate the application’s $baseUrl. This bypasses the endpoint’s internal URL validation, forcing the backend Guzzle client to fetch a malicious payload from an attacker-controlled server and reflect it to the client with a Content-Type: application/javascript header. The vulnerability manifests when assetManager.cacheSourcePaths is set to false. This issue has been fixed in versions 4.18.0 and 5.10.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Craft CMS is a content management system (CMS). Versions 4.0.0-RC1 and above, prior to 4.18.0 and 5.0.0-RC1, and above, prior to 5.10.0, are vulnerable to Server-Side Request Forgery (SSRF) and Arbitrary JavaScript Injection through the /actions/app/resource-js endpoint. By exploiting the default permissive trustedHosts configuration, an attacker can poison the Host or X-Forwarded-Host header to manipulate the application’s $baseUrl. This bypasses the endpoint’s internal URL validation, forcing the backend Guzzle client to fetch a malicious payload from an attacker-controlled server and reflect it to the client with a Content-Type: application/javascript header. The vulnerability manifests when assetManager.cacheSourcePaths is set to false. This issue has been fixed in versions 4.18.0 and 5.10.0.","source":"cvelist"},{"lang":"en","text":"**1. Overview**\n\nCraft CMS is vulnerable to Server-Side Request Forgery (SSRF) and Arbitrary JavaScript Injection through the `/actions/app/resource-js` endpoint. By exploiting the default permissive `trustedHosts` configuration, an attacker can poison the `Host` or `X-Forwarded-Host` header to manipulate the application’s `$baseUrl`. This bypasses the endpoint’s internal URL validation, forcing the backend Guzzle client to fetch a malicious payload from an attacker-controlled server and reflect it to the client with a `Content-Type: application/javascript` header.\n\n**2. Vulnerability Mechanism (Root Cause)**\nThe vulnerability manifests when `assetManager.cacheSourcePaths` is set to `false`. The attack chain relies on three structural flaws and insecure defaults:\n\n- **A. Default Proxy Trust (`trustedHosts`):** Craft’s default `GeneralConfig::$trustedHosts` is set to `['any']`. This allows an attacker to bypass front-end web server (Nginx/Apache) strict `Host` header validations by simply injecting an `X-Forwarded-Host` header. Yii2 will parse this and globally set `$baseUrl` to the attacker's domain.\n- **B. Insecure HTTP Client (`actionResourceJs`):** In `AppController::actionResourceJs()`, the `str_starts_with($url, $baseUrl)` validation is bypassed because `$baseUrl` is already poisoned by the attacker. The core then uses `Craft::createGuzzleClient()->get($url)`. Unlike the GraphQL Asset fetcher, this Guzzle instance defaults to `ALLOW_REDIRECTS => true`.\n- **C. Forced JS Content-Type:** The response fetched from the attacker's server is blindly returned to the user via `$this->asRaw()` with the header `Content-Type: application/javascript`.\n\n**3. Attack Scenario & Impact (Proof of Exploitability)**\nThis endpoint acts as a proxy, taking remote, unverified content and serving it as valid JavaScript. While the direct SSRF allows for internal network probing, the most devastating impact occurs when caching layers are involved.\n\nIf the Craft CMS instance is behind a caching layer, this vulnerability leads directly to **Web Cache Poisoning**:\n\n1. An unauthenticated attacker sends the poisoned request.\n2. The caching layer caches the malicious JavaScript response for the legitimate `/actions/app/resource-js` URI.\n3. When an authenticated Administrator logs into the Control Panel, their browser loads the poisoned cached JavaScript (**Stored XSS**).\n4. The malicious script extracts `window.Craft.csrfTokenValue` and silently sends a POST request to `/admin/actions/plugins/install-plugin`, achieving **1-Click Remote Code Execution (RCE)** via Session Riding.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Craft CMS es un sistema de gestión de contenido (CMS). Las versiones 4.0.0-RC1 y superiores, anteriores a la 4.18.0, y 5.0.0-RC1 y superiores, anteriores a la 5.10.0, son vulnerables a la falsificación de petición del lado del servidor (SSRF) e inyección arbitraria de JavaScript a través del endpoint /actions/app/resource-js. Al explotar la configuración permisiva predeterminada de trustedHosts, un atacante puede envenenar la cabecera Host o X-Forwarded-Host para manipular el $baseUrl de la aplicación. Esto elude la validación interna de URL del endpoint, forzando al cliente Guzzle del backend a obtener una carga útil maliciosa de un servidor controlado por el atacante y reflejarla al cliente con una cabecera Content-Type: application/javascript. La vulnerabilidad se manifiesta cuando assetManager.cacheSourcePaths se establece en false. Este problema ha sido solucionado en las versiones 4.18.0 y 5.10.0.","source":"nvd"}],"published":"2026-06-19T21:15:19.000Z","modified":"2026-10-25T21:10:00.770Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:L/SI:N/SA:N","rating":"CRITICAL"}],"cwes":["CWE-79","CWE-346","CWE-644","CWE-918"],"affected":[{"ranges":[{"version":">= 5.0.0-RC1, < 5.10.0","status":"affected"},{"version":">= 4.0.0-RC1, < 4.18.0","status":"affected"}],"vendor":"craftcms","product":"cms","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"5.0.0-RC1","status":"affected","fixed":"5.10"}],"ecosystem":"Packagist","package":"craftcms/cms","purl":"pkg:composer/craftcms/cms","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"4.0.0-RC1","status":"affected","fixed":"4.18"}],"ecosystem":"Packagist","package":"craftcms/cms","purl":"pkg:composer/craftcms/cms","source":"ghsa"}],"references":[{"url":"https://github.com/craftcms/cms/security/advisories/GHSA-c55v-343g-5xff","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/craftcms/cms/pull/18559","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/craftcms/cms","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-07-02T14:53:40.361Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-55791","url":"https://www.cve.org/CVERecord?id=CVE-2026-55791","licence":"CVE Terms of Use","modified":"2026-07-02T15:54:26.284Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c55v-343g-5xff","url":"https://github.com/advisories/GHSA-c55v-343g-5xff","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:08.401Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-55791","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-55791","licence":"Public domain","modified":"2026-10-25T21:10:00.770Z"}],"updatedAt":"2026-11-25T22:59:26.986Z","epss":{"score":0.00331,"percentile":0.28284,"date":"2026-12-01T12:00:22.000Z"}}