DEV Community

StarkMan
StarkMan

Posted on

Craft CMS image transforms must reject attacker-selected classes

Craft CMS image transforms must reject attacker-selected classes

Craft CMS 5.0.0 before 5.11.4 contains a critical object-creation flaw in ImageTransforms::normalizeTransform(). The CVE record says an attacker can supply class:null with a __class key and reach instantiation of arbitrary classes.

The published attack path goes through Craft Commerce's payments/pay template and customer.photo.getUrl() with a crafted transform. The record names yii\rbac\PhpManager as one class that can lead to PHP execution. The broad CVSS score reflects network access, no privileges and high impact, but deployment details still determine whether the vulnerable path is reachable.

The underlying mistake is allowing request data to choose a PHP class name. Object hydration and transform normalization are configuration features; they are not safe places to accept arbitrary class selectors from a user.

Upgrade Craft CMS to 5.11.4 or later. After patching, audit custom modules, plugins and templates that call image transforms with request-derived arrays. A wrapper around getUrl() should accept a fixed transform name or an allowlisted map. It should not pass a nested structure directly into Craft's normalization logic.

Review class autoload and object-creation sinks for user-controlled __class, class, type or equivalent keys. Where object hydration is necessary, use a class allowlist and an explicit constructor contract. Disable or restrict the Commerce payment path until the patch is verified if the site does not need it.

Logging should capture the request route, actor state, transform identifier and whether the request attempted to provide a class. A blocked class selector is a useful hunting signal, especially on public commerce endpoints. Do not store full request bodies when they may contain customer data.

For an exposed site, check for unexpected PHP files, template changes, new administrator accounts and outbound connections after the update. Configuration review alone does not establish that no object was instantiated before the patch.

References

Top comments (0)