Summary
Craft CMS is Vulnerable to Authenticated Remote Code Execution via Malicious Attached Behavior
A Remote Code Execution (RCE) vulnerability exists in Craft CMS 5.x and 4.x that bypasses the security fixes for GHSA-7jx7-3846-m7w7 and GHSA-255j-qw47-wjh5. This vulnerability can be exploited by any authenticated user with control panel access.
The existing patches add cleanseConfig() to assembleLayoutFromPost() and various FieldsController actions to strip Yii2 behavior/event injection keys (as and on prefixed keys). However, the fieldLayouts parameter in ElementIndexesController::actionFilterHud() is passed directly to FieldLayout::createFromConfig() without any sanitization, enabling the same behavior injection attack chain.
Vulnerability Details
Root Cause
In ElementIndexesController::actionFilterHud() (line 493-494), the fieldLayouts body parameter is passed to FieldLayout::createFromConfig() without cleanseConfig():
// ElementIndexesController.php:485-494
if ($conditionConfig) {
$conditionConfig = Component::cleanseConfig($conditionConfig); // conditionConfig IS cleansed
$condition = $conditionsService->createCondition($conditionConfig);
} else {
$condition = $this->elementType()::createCondition();
}
if (!empty($fieldLayouts)) {
// fieldLayouts is NOT cleansed!
$condition->setFieldLayouts(array_map(
fn(array $config) => FieldLayout::createFromConfig($config),
$fieldLayouts
));
}
Note the inconsistency: conditionConfig is sanitized with cleanseConfig(), but fieldLayouts is not.
Attack Chain
- Send a
fieldLayoutsarray containing config with"as <name>"prefixed keys FieldLayout::createFromConfig($config)->new self($config)->Model::__construct($config)App::configure($this, $config)processes each key"as rce"key ->Component::__set("as rce", $value)->Yii::createObject($value)-> instantiatesAttributeTypecastBehaviorand attaches it to the FieldLayout"on *"key -> registers a wildcard event handlerparent::__construct()->init()->setTabs([])->getAvailableNativeFields()->trigger(EVENT_DEFINE_NATIVE_FIELDS)- The wildcard handler fires ->
AttributeTypecastBehavior::beforeSave()->typecastAttributes() $this->owner->typecastBeforeSave-> resolved viaComponent::__get()-> returns the command string from the behavior's own propertycall_user_func([ConsoleProcessus::class, 'execute'], $command)->shell_exec($command)
Prerequisites
- A user account with control panel access
Impact
- Attack Type: Remote Code Execution (RCE)
- Authentication Required: Authenticated user with control panel access (
accessCppermission)
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-33157? CVE-2026-33157 is a high-severity security vulnerability in craftcms/cms (composer), affecting versions >= 5.6.0, <= 5.9.12. It is fixed in 5.9.13.
- Which versions of craftcms/cms are affected by CVE-2026-33157? craftcms/cms (composer) versions >= 5.6.0, <= 5.9.12 is affected.
- Is there a fix for CVE-2026-33157? Yes. CVE-2026-33157 is fixed in 5.9.13. Upgrade to this version or later.
- Is CVE-2026-33157 exploitable, and should I be worried? Whether CVE-2026-33157 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-33157 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-33157? Upgrade
craftcms/cmsto 5.9.13 or later.