Craft CMS RCE via Image Transform Class Bypass (CVE-2026-130675)
A Craft CMS 5.0.0 to 5.11.3 image-transform class bypass can lead to PHP code execution; fixed in 5.11.4.
TL;DR
- A class-guard bypass in Craft CMS image transforms lets an attacker instantiate arbitrary PHP classes, which the vendor says can lead to remote code execution. VulnCheck rated it CVSS v3.1 9.8 Critical on 2026-11-18.
- Affects Craft CMS 5.0.0 to 5.11.3. The fix is in 5.11.4, released on 2026-10-01.
- No exploitation in the wild is known, and the CVE is not in KEV as of 2026-11-18.
- Upgrade to 5.11.4 or later, and review the Craft Commerce payments/pay template and public profile-photo access.
Am I affected?
All of these must hold:
- Craft CMS 5.0.0 or later, but earlier than 5.11.4, is installed.
- Craft Commerce is installed and the
payments/payaction is reachable. - A public user with a profile photo can reach the sandboxed template that calls
customer.photo.getUrl(). - The deployment accepts an attacker-controlled image transform array through that template.
The vendor advisory lists 5.0.0 to 5.11.3 and says the flaw is reachable through Craft Commerce's payments/pay redirect template. The vendor describes the impact as an unauthenticated remote attacker executing PHP "in the right circumstances". The advisory does not publish a full end-to-end exploit, and no public proof of concept is linked.
Craft CMS had 86,099 Packagist downloads in the month to 2026-11-18 and 3,891,091 in total. That figure covers the craftcms/cms package, not the number of sites that run Craft Commerce.
Craft Commerce is a separate commercial plugin. Check it with composer show craftcms/commerce. A site without the plugin does not match the documented path, but the class guard is still part of Craft CMS, so the upgrade applies either way.
| Branch | Affected versions | Fixed version |
|---|---|---|
| 5.x | 5.0.0 to 5.11.3 | 5.11.4 |
| 4.x and earlier | Not listed as affected | Not applicable |
Check what is installed:
# The installed Craft CMS version
composer show craftcms/cms | grep -E "^versions|^name"
# The locked version in a project
grep -n -A 2 '"name": "craftcms/cms"' composer.lock
# The Craft CLI, when the project ships it
php craft --version
How do I fix it?
Upgrade to 5.11.4 or later and run the migration. The fix is in the class guard, so a template change alone does not remove it.
- Upgrade the package and run the database migrations:
composer require craftcms/cms:^5.11.4
php craft migrate/all
- Rebuild every container or release artifact that pins an earlier 5.x version, then clear the compiled templates and caches:
php craft clear-caches
-
Review the
payments/paytemplate and the public profile-photo feature. If you do not need either, disable them until the upgrade is deployed. -
If you cannot upgrade yet, remove public profile photos and restrict access to the
payments/payaction at the web server. That reduces the documented path, but it does not fix the class guard, so treat it as temporary. -
Read the 5.11.4 release notes before you deploy. The same release carries other security fixes, and the migrations should run on a staging copy first.
The fix does not change the transform API, so existing image transform configurations keep working. Test one transform on a staging copy after the upgrade and confirm the generated URLs still resolve.
What is the root cause?
The transform normalizer tries to stop an attacker from choosing the PHP class, but its guard uses isset() and the later array spread lets the attacker overwrite the fixed class. The vendor's advisory calls the result an arbitrary class instantiation primitive.
The vulnerable code is in src/helpers/ImageTransforms.php at 5.11.3:
if (isset($transform['class'])) {
throw new InvalidArgumentException('Invalid transform config.');
}
// ...
return Craft::createObject([
'class' => ImageTransform::class,
...$transform,
]);
isset($transform['class']) returns false when the value is null. The spread then overwrites the class entry with the attacker's null and adds a __class entry. The second guard in Craft::createObject() has the same problem:
if (is_array($type) && isset($type['__class']) && isset($type['class'])) {
throw new InvalidConfigException('`__class` and `class` cannot both be specified.');
}
With class set to null, the second isset() is false, so the conflict check is bypassed. Yii gives __class precedence when both keys are present, so the attacker's class is instantiated with the attacker's properties.
Component::cleanseConfig() does not remove __class. The method cleans the configuration values and leaves the key in place, so the attacker's class name survives the normalization step. The guard that was meant to reject it is the one that isset() defeats.
How is it exploited?
The attacker needs a path that passes an attacker-controlled transform array into ImageTransforms::normalizeTransform(). The vendor documents one path through Craft Commerce.
- A public user with a profile photo reaches the
payments/payaction. Craft Commerce renders the signedredirectparameter as a sandboxed Order template. - The template calls
customer.photo.getUrl()with a transform array that containsclass => null,__class => 'yii\rbac\PhpManager', and attacker-controlled properties. normalizeTransform()runsisset()onclass, seesnull, and does not throw.Craft::createObject()receivesclass => nulland__class => 'yii\rbac\PhpManager', and its dual-class check also passes.- Yii instantiates the attacker's class with the attacker's properties. The advisory names
yii\rbac\PhpManageras an example and says the result can execute PHP.
The advisory publishes this transform shape:
[
'class' => null,
'__class' => 'yii\rbac\PhpManager',
// attacker-controlled properties
]
The vendor's impact sentence is conditional: an unauthenticated remote attacker can execute PHP "in the right circumstances". The documented circumstances are a Craft Commerce site, a reachable payments/pay action, and a public user with a profile photo.
How does the attack flow?
A transform array that looks like a normal image configuration passes two isset() guards and reaches Yii's class instantiation, where the attacker's class name wins.
with a crafted transform"] C --> D["normalizeTransform: isset(class) is false"] D --> E["Craft::createObject: dual-class check is bypassed"] E --> F["Yii instantiates __class
with attacker properties"] F --> G["PHP code execution"]
What can an attacker do?
The attacker can instantiate an arbitrary autoloadable PHP class with attacker-controlled properties. The advisory says that can lead to PHP code execution, and the vendor rates the issue high severity.
- Code execution runs as the PHP process user, which can read the Craft
.envfile and the database credentials. - The attacker can read and write files that the web server can reach, including templates and uploaded assets.
- The attacker can reach the database and the Craft control panel with the application's own credentials.
- The attacker can use the site as a base for further access to the hosting account.
The advisory does not demonstrate a specific end-to-end payload or a particular class chain beyond naming yii\rbac\PhpManager. That class is a plausible gadget because it loads its RBAC data with require in loadFromFile(). If the attacker can point itemFile at a file they can write, the require executes it. Treat the code-execution claim as the vendor's and VulnCheck's assessment, not as a demonstrated exploit against every configuration.
The conditions are listed in full in "Am I affected?". A site without Craft Commerce, or one that does not expose the payments/pay action to public users, does not match the documented path.
The gap between instantiating a class and executing code is the gadget chain. The advisory names one class, and the vendor says the right circumstances are needed. A site that matches the documented path but blocks writes to the web root may still be exposed through a different class, so the safe response is the upgrade, not a gadget-specific block.
If the attacker reaches code execution, their PHP runs with the same database and file permissions as the Craft process, so the site's own secrets are in scope even when the attacker never reaches the control panel.
Why does the fix work?
The fix replaces both isset() checks with array_key_exists() and moves the spread before the fixed class entry, so the attacker cannot overwrite it.
- if (isset($transform['class'])) {
+ if (array_key_exists('class', $transform) || array_key_exists('__class', $transform)) {
throw new InvalidArgumentException('Invalid transform config.');
}
@@
return Craft::createObject([
- 'class' => ImageTransform::class,
...$transform,
+ 'class' => ImageTransform::class,
]);
- if (is_array($type) && isset($type['__class']) && isset($type['class'])) {
+ if (is_array($type) && array_key_exists('__class', $type) && array_key_exists('class', $type)) {
throw new InvalidConfigException('`__class` and `class` cannot both be specified.');
}
array_key_exists() returns true for a key whose value is null, so the guard now rejects the class => null shape. Moving the spread before the fixed entry means the fixed class always wins, even if a future caller forgets the first guard. The commit also adds regression tests for the null-class and nested-transform cases.
How do I check if I was compromised?
There are no published indicators of compromise. The request is a normal payments/pay request with a signed redirect, and the exploit shape is visible only in the request body or the template output.
# Requests to the Commerce pay action
grep -i "payments/pay" /var/log/nginx/access.log /var/log/apache2/access.log 2>/dev/null
# Class markers appear only if the logged request retains the decoded template.
# Default access logs omit POST bodies; encoded redirects need decoding first.
grep -i "__class\|PhpManager\|class%3Anull\|class.*null" /var/log/nginx/access.log /var/log/apache2/access.log 2>/dev/null
# Unexpected PHP files in the web root
find /path/to/craft/web -name '*.php' -mtime -30 2>/dev/null
A hit on payments/pay is a lead, not proof, because the action is part of normal checkout. A hit that also contains __class, PhpManager, or a class value of null is much stronger. If you find one, preserve the logs, review the Craft users and database accounts, and rebuild the host from a trusted image.
Log retention decides whether this check is possible. If the web server keeps only a few days of access logs, export them before the window closes. The request body is often not logged at all, so a proxy or application-level log is the only place the transform array appears.
Timeline
- 2026-09-28: commit
0d1d8c55fixes the class guard. - 2026-10-01: Craft CMS 5.11.4 is released.
- 2026-11-02: the vendor publishes advisory GHSA-hq78-cm2m-h24h.
- 2026-11-18: VulnCheck publishes CVE-2026-130675 with CVSS v3.1 9.8 and v4.0 9.3.
- 2026-11-18: the CVE is not in KEV and no exploitation is known.
FAQ
Is it unauthenticated?
The vendor says an unauthenticated remote attacker can execute PHP in the right circumstances. The documented path starts with a public user who has a profile photo, so the attacker may need to register or to control such an account on the site.
Does it affect Craft 4?
The vendor advisory lists Craft CMS 5.0.0 to 5.11.3. It does not list 4.x, and the fix is in the 5.x line. Treat 4.x as outside this advisory, not as confirmed safe.
Is there a public exploit?
No working exploit code is published. The advisory documents the transform array and the Twig accessor, and the CVE record repeats that shape.
Is Craft Commerce required?
The documented path uses Craft Commerce's payments/pay template. The class guard is in Craft CMS itself, so another template that passes attacker-controlled transforms could reach the same code. The advisory does not name one.
Was it exploited in the wild?
No exploitation is known. The CVE is not in KEV as of 2026-11-18, and neither the vendor nor VulnCheck reports an attack.
Why does the vendor rate it high when the CVE is 9.8?
Craft's security policy rates impact by the access an attacker needs and the effect they can have. The vendor calls this a high-severity RCE, while VulnCheck, as the CVE numbering authority, scores the network vector at 9.8. Both descriptions refer to the same flaw; the difference is the scoring policy, not the affected code.
How do I know whether Craft Commerce is installed?
Run composer show craftcms/commerce in the project. The command prints the plugin version when it is installed and exits with an error when it is not. The control panel's plugin list also names it.
Does 5.11.4 fix it?
Yes. 5.11.4 contains the fix commit and the regression tests. Any later 5.x release carries the same change.
Find exposed Craft CMS sites with Ostorlab
Ostorlab's Web Agentic Deep Scan inventories and tests the web applications you expose. For a Craft CMS site, it maps the public templates and Commerce actions, plus the authentication in front of them. You can see which sites expose the documented path before you upgrade.
References
- GitHub Advisory Database, GHSA-hq78-cm2m-h24h, "Image transform class guard with
class:nulland__classbypass can lead to RCE": https://github.com/craftcms/cms/security/advisories/GHSA-hq78-cm2m-h24h (checked November 18, 2026) - CVE record, CVE-2026-130675: https://www.cve.org/CVERecord?id=CVE-2026-130675 (checked November 18, 2026)
- Craft CMS fix commit
0d1d8c55, "Fixed GHSA-hq78-cm2m-h24h": https://github.com/craftcms/cms/commit/0d1d8c55602042b2313448e560a2c0e4f582b498 (checked November 18, 2026) - Craft CMS 5.11.4 release: https://github.com/craftcms/cms/releases/tag/5.11.4 (checked November 18, 2026)
- Craft CMS source at 5.11.3,
ImageTransforms.php: https://github.com/craftcms/cms/blob/5.11.3/src/helpers/ImageTransforms.php (checked November 18, 2026) - Craft CMS source at 5.11.3,
Craft.php: https://github.com/craftcms/cms/blob/5.11.3/src/Craft.php (checked November 18, 2026) - Craft CMS source at 5.11.3,
Component.php: https://github.com/craftcms/cms/blob/5.11.3/src/helpers/Component.php (checked November 18, 2026) - Yii 2
PhpManagersource,loadFromFile(): https://github.com/yiisoft/yii2/blob/master/framework/rbac/PhpManager.php (checked November 18, 2026) - Packagist,
craftcms/cmsdownload statistics: https://packagist.org/packages/craftcms/cms (checked November 18, 2026) - CISA Known Exploited Vulnerabilities catalog: https://www.cisa.gov/known-exploited-vulnerabilities-catalog (checked November 18, 2026)