/

CVE-2026-112774

Severity:

HIGH RISK

(7.2)

Code Injection (CWE-94) in Craft CMS Field Layout UI

CVE-2026-112774

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Craft CMS contains a code injection vulnerability in field layout processing that allows authenticated administrators to inject Yii behaviors through a crafted JSON field layout.

When administrative changes are enabled, a malicious administrator may execute operating system commands as the web server user and access application secrets.

Craft CMS contains a code injection vulnerability in field layout processing that allows authenticated administrators to inject Yii behaviors through a crafted JSON field layout.

When administrative changes are enabled, a malicious administrator may execute operating system commands as the web server user and access application secrets.

Affected context

The vulnerability occurs in Craft CMS versions that process administrator-controlled JSON field layouts through ContentBlock::setFieldLayout(). It becomes risky when allowAdminChanges is enabled and an authenticated administrator can submit layouts containing behavior-related keys that are not adequately removed during configuration cleansing.

The vulnerability occurs in Craft CMS versions that process administrator-controlled JSON field layouts through ContentBlock::setFieldLayout(). It becomes risky when allowAdminChanges is enabled and an authenticated administrator can submit layouts containing behavior-related keys that are not adequately removed during configuration cleansing.

Exploit preconditions

  • Attack surface: Craft CMS administrative field layout management
  • Required access: Authenticated administrator privileges or equivalent permission to modify field layouts
  • Deployment condition: allowAdminChanges must be enabled
  • Trigger point: Processing a supplied JSON string field layout through ContentBlock::setFieldLayout()
  • Why exploitation is possible: Certain as X or on X keys can bypass configuration cleansing and cause attacker-controlled Yii behaviors to be interpreted as executable configuration
  • Attack surface: Craft CMS administrative field layout management
  • Required access: Authenticated administrator privileges or equivalent permission to modify field layouts
  • Deployment condition: allowAdminChanges must be enabled
  • Trigger point: Processing a supplied JSON string field layout through ContentBlock::setFieldLayout()
  • Why exploitation is possible: Certain as X or on X keys can bypass configuration cleansing and cause attacker-controlled Yii behaviors to be interpreted as executable configuration

Why this happens

The underlying issue is insufficiently constrained processing of administrator-supplied configuration data. Although cleanseConfig() is intended to remove unsafe behavior definitions, specially named behavior keys can bypass that cleansing step and reach Yii's behavior-resolution mechanisms.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because attacker-controlled configuration is interpreted in a way that can trigger executable behavior and operating system command execution.

The underlying issue is insufficiently constrained processing of administrator-supplied configuration data. Although cleanseConfig() is intended to remove unsafe behavior definitions, specially named behavior keys can bypass that cleansing step and reach Yii's behavior-resolution mechanisms.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because attacker-controlled configuration is interpreted in a way that can trigger executable behavior and operating system command execution.

Potential impact

  • An attacker may execute commands with the privileges of the web server process.
  • Application secrets, credentials, or environment data could be disclosed.
  • Website content and administrative configuration could be modified.
  • The compromised application could be used to access connected services or internal systems.
  • Data integrity and platform availability could be affected.
  • An attacker may execute commands with the privileges of the web server process.
  • Application secrets, credentials, or environment data could be disclosed.
  • Website content and administrative configuration could be modified.
  • The compromised application could be used to access connected services or internal systems.
  • Data integrity and platform availability could be affected.

General mitigation guidance

Mitigation generally focuses on preventing user-controlled field layout data from reaching executable behavior mechanisms.

Common defensive patterns include:

  • Restricting field layout input to an explicit schema and allowlisted keys.
  • Rejecting behavior declarations and other executable configuration constructs in user-supplied JSON.
  • Applying validation before any framework behavior resolution or object configuration occurs.
  • Disabling administrative configuration changes when they are not required.
  • Separating content administration from system configuration privileges.
  • Running the web process with least privilege and limiting access to secrets and sensitive operating-system resources.
  • Reducing trust in administrative input through approval workflows, audit logging, and change monitoring.

Mitigation generally focuses on preventing user-controlled field layout data from reaching executable behavior mechanisms.

Common defensive patterns include:

  • Restricting field layout input to an explicit schema and allowlisted keys.
  • Rejecting behavior declarations and other executable configuration constructs in user-supplied JSON.
  • Applying validation before any framework behavior resolution or object configuration occurs.
  • Disabling administrative configuration changes when they are not required.
  • Separating content administration from system configuration privileges.
  • Running the web process with least privilege and limiting access to secrets and sensitive operating-system resources.
  • Reducing trust in administrative input through approval workflows, audit logging, and change monitoring.

How teams detect issues like this

Detection can include static analysis and code review for paths where JSON or form input is passed into framework configuration, behavior attachment, object construction, or command-related APIs.

Useful signals include:

  • Calls to field layout setters that accept raw serialized input.
  • Cleansing routines that rely on denylisting special keys.
  • Administrative endpoints that permit dynamic behavior or event configuration.
  • Runtime requests containing unexpected as or on configuration keys.
  • Web-process child-process creation, unusual command execution, or access to environment and secret files after administrative changes.

Automated security scanning and policy checks can help flag executable configuration flows during pull requests and deployment validation.

Detection can include static analysis and code review for paths where JSON or form input is passed into framework configuration, behavior attachment, object construction, or command-related APIs.

Useful signals include:

  • Calls to field layout setters that accept raw serialized input.
  • Cleansing routines that rely on denylisting special keys.
  • Administrative endpoints that permit dynamic behavior or event configuration.
  • Runtime requests containing unexpected as or on configuration keys.
  • Web-process child-process creation, unusual command execution, or access to environment and secret files after administrative changes.

Automated security scanning and policy checks can help flag executable configuration flows during pull requests and deployment validation.

Sources

SourceLink
github.comgithub.com/craftcms/cms/security/advisories/GHSA-j6r9-fxgv-j7x5
vulncheck.comvulncheck.com/advisories/craft-cms-5.8.0-before-5.11.0-admin-rce-via-contentblock-field-layout

Frequently asked

questions

It can be exploited through the Craft CMS administrative interface when the vulnerable field layout processing path is reachable. It is not generally an unauthenticated attack because administrative access is normally required.

The attacker needs authenticated administrative privileges, or another capability that permits modifying field layouts, and administrative changes must be enabled.

Prevent untrusted JSON from being interpreted as executable framework configuration. Use strict allowlisted schemas, reject behavior declarations, and validate input before framework processing.

Treat administrative configuration as a security-sensitive input boundary, minimize administrator privileges, disable unnecessary configuration changes, monitor layout modifications, and run the application with least privilege.

It can be exploited through the Craft CMS administrative interface when the vulnerable field layout processing path is reachable. It is not generally an unauthenticated attack because administrative access is normally required.

The attacker needs authenticated administrative privileges, or another capability that permits modifying field layouts, and administrative changes must be enabled.

Prevent untrusted JSON from being interpreted as executable framework configuration. Use strict allowlisted schemas, reject behavior declarations, and validate input before framework processing.

Treat administrative configuration as a security-sensitive input boundary, minimize administrator privileges, disable unnecessary configuration changes, monitor layout modifications, and run the application with least privilege.

Find out what's already
exploitable in your codebase.