CVE-2026-25498: Craft has a potential authenticated Remote Code Execution via malicious attached Behavior

Published Feb 9, 2026
·
Updated

Relationship to Previously Patched Vulnerability

This vulnerability is in addition to the RCE vulnerability patched in GHSA-255j-qw47-wjh5. That advisory addressed a similar RCE vulnerability that affected two specific routes:

- /index.php?p=admin%2Factions%2Ffields%2Fapply-layout-element-settings - /index.php?p=admin%2Factions%2Ffields%2Frender-card-preview

This one addresses some additional endpoints that were not covered in the https://github.com/craftcms/cms/security/advisories/GHSA-255j-qw47-wjh5.

The patched vulnerability used a malicious AttributeTypecastBehavior with a wildcard event listener ("on ": "self::beforeSave") and construct() syntax to trigger RCE via the typecastBeforeSave callback. The fix was implemented in commits: - 6e608a1 - 27f5588 - ec43c49

This vulnerability follows the same attack pattern (behavior injection via "as <behavior>" syntax) but affects a different code path (assembleLayoutFromPost() in Fields.php) that was not patched in those commits. The attack vector uses typecastAfterValidate instead of typecastBeforeSave and does not require the wildcard event listener syntax, demonstrating that multiple entry points exist for this type of vulnerability.

---

Executive Summary

A Remote Code Execution (RCE) vulnerability exists in Craft CMS where the assembleLayoutFromPost() function in src/services/Fields.php fails to sanitize user-supplied configuration data before passing it to Craft::createObject(). This allows authenticated administrators to inject malicious Yii2 behavior configurations that execute arbitrary system commands on the server. This vulnerability represents an unpatched variant of the behavior injection vulnerability addressed in GHSA-255j-qw47-wjh5, affecting different endpoints through a separate code path.

---

Vulnerability Details

Attack Prerequisites

- Authentication: Admin-level access required - Network Access: Access to admin panel (/admin)

---

Location

- File: src/services/Fields.php - Function: assembleLayoutFromPost() (lines 1125-1143) - Root Cause: Missing cleanseConfig() call on user-supplied fieldLayout POST parameter

Vulnerable Code Path

php // src/services/Fields.php:1125-1133 public function assembleLayoutFromPost(?string $namespace = null): FieldLayout { $paramPrefix = $namespace ? rtrim($namespace, '.') . '.' : ''; $request = Craft::$app->getRequest(); $config = JsonHelper::decode($request->getBodyParam("{$paramPrefix}fieldLayout")); // ... additional config values added ... $layout = $this->createLayout($config); // <-- No cleanseConfig() call! // ... }

// src/services/Fields.php:1089-1093 public function createLayout(array $config): FieldLayout { $config['class'] = FieldLayout::class; return Craft::createObject($config); // <-- Untrusted data passed directly } ---

Attack Chain

The exploitation leverages Yii2's object configuration system and behavior attachment mechanism:

1. Behavior Injection: Attacker includes 'as rce' key in the fieldLayout JSON POST parameter 2. Object Creation: Craft::createObject() processes the config through Yii2's BaseYii::configure() 3. Behavior Attachment: Yii2's Component::set() detects the 'as ' prefix and attaches the behavior 4. RCE Trigger: When validate() is called on the model, EVENTAFTERVALIDATE fires 5. Command Execution: AttributeTypecastBehavior calls the configured typecast function (ConsoleProcessus::execute) with the uid attribute value as the command

RCE Gadget Chain

FieldLayout POST parameter → Craft::createObject() → Yii2 Component::set() with 'as rce' key → AttributeTypecastBehavior attached → Model::validate() called → EVENTAFTERVALIDATE triggered → typecastAfterValidate → typecastAttributes() → calluserfunc(['Psy\Readline\Hoa\ConsoleProcessus', 'execute'], $command) → Shell command execution

---

Affected Controllers

The assembleLayoutFromPost() function is called by multiple admin controllers:

| Controller | Action | Permission Required | |------------|--------|---------------------| | TagsController | actionSaveTagGroup() | Admin | | CategoriesController | actionSaveGroup() | Admin | | EntryTypesController | actionSave() | Admin | | GlobalsController | actionSaveSet() | Admin | | VolumesController | actionSave() | Admin | | UsersController | actionSaveUserFieldLayout() | Admin | | AddressesController | actionSaveAddressFieldLayout() | Admin |

--- References

- https://github.com/craftcms/cms/commit/395c64f0b80b507be1c862a2ec942eaacb353748 - GHSA-255j-qw47-wjh5 - Previously patched RCE vulnerability via behavior injection (affecting different endpoints) - CVE-2024-4990 - Related vulnerability that inspired the behavior injection attack pattern - Yii2 GHSA-gcmh-9pjj-7fp4 - Original Yii framework report (framework team declined to fix at framework level)

---

Other sources

Craft is a platform for creating digital experiences. In versions 4.0.0-RC1 through 4.16.17 and 5.0.0-RC1 through 5.8.21, a Remote Code Execution (RCE) vulnerability exists in Craft CMS where the assembleLayoutFromPost() function in src/services/Fields.php fails to sanitize user-supplied configuration data before passing it to Craft::createObject(). This allows authenticated administrators to inject malicious Yii2 behavior configurations that execute arbitrary system commands on the server. This vulnerability represents an unpatched variant of the behavior injection vulnerability addressed in CVE-2025-68455, affecting different endpoints through a separate code path. This vulnerability is fixed in 5.8.22.

MITRE

Affected Software

11 affected componentsFixes available
Craft CMS Craft>=4.0.0-RC1<=4.16.17, >=5.0.0-RC1<=5.8.21
composer/craftcms/cms>=4.0.0-RC1<=4.16.17
4.16.18
composer/craftcms/cms>=5.0.0-RC1<=5.8.21
5.8.22
CraftCMS Craft CMS>4.0.0<4.16.18
CraftCMS Craft CMS>5.0.0<5.8.22
CraftCMS Craft CMS=4.0.0
CraftCMS Craft CMS=4.0.0-rc1
CraftCMS Craft CMS=4.0.0-rc2
CraftCMS Craft CMS=4.0.0-rc3
CraftCMS Craft CMS=5.0.0
CraftCMS Craft CMS=5.0.0-rc1

Event History

Feb 9, 2026
CVE Published
via MITRE·07:55 PM
Data Sourced
via MITRE·07:55 PM
DescriptionWeakness
Data Sourced
via NVD·08:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·08:36 PM
Data Sourced
via GitHub·08:36 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-25498?

CVE-2026-25498 is classified as a high severity vulnerability due to its potential for remote code execution.

2

How do I fix CVE-2026-25498?

To fix CVE-2026-25498, upgrade Craft CMS to version 5.8.22 or later, or version 4.16.18 or later.

3

Who is affected by CVE-2026-25498?

CVE-2026-25498 affects Craft CMS versions 4.0.0-RC1 through 4.16.17 and 5.0.0-RC1 through 5.8.21.

4

What type of vulnerability is CVE-2026-25498?

CVE-2026-25498 is a remote code execution (RCE) vulnerability.

5

What implications does CVE-2026-25498 have for my website?

Exploitation of CVE-2026-25498 could allow an attacker to execute arbitrary code on your server, potentially compromising your website.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203