/

CVE-2026-86730

Severity:

HIGH RISK

(8.8)

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

CVE-2026-86730

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(8.8)

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

A code injection vulnerability in Craft CMS allows authenticated control-panel users to bypass cleansing for string-typed field-layout elements.

By supplying crafted JSON strings, an attacker may cause Yii2 behavior attachments and event handlers to be instantiated, potentially leading to arbitrary code execution when the application processes the layout.

Affected context

The vulnerability occurs in Craft CMS control-panel functionality that processes field-layout elements supplied as JSON strings. It becomes risky when an authenticated user can submit or modify field layouts and the application accepts string-typed elements without fully applying cleansing and validation before object creation.

Exploit preconditions

  • Attack surface: Craft CMS control-panel field-layout management functionality
  • Required access: Authenticated access with permission to submit or modify affected field-layout data
  • Trigger point: Processing of crafted field-layout elements through the application's object-creation path
  • Why exploitation is possible: String-form layout elements can bypass cleansing validation and reach dynamic Yii2 behavior or event-handler instantiation

Why this happens

The underlying issue is insufficient validation and normalization of string-typed field-layout elements before they are passed to dynamic object-construction logic.

When attacker-controlled input can influence behavior attachments, event handlers, or other class-oriented data, a call such as Craft::createObject() may instantiate unintended objects and execute associated behavior. This maps to CWE-94: Improper Control of Generation of Code, because untrusted input influences executable application behavior rather than remaining limited to inert configuration data.

Potential impact

  • An attacker could execute arbitrary code in the Craft CMS application context
  • The application and its hosted content could be compromised
  • Sensitive configuration data or credentials may be exposed
  • The attacker could alter content, create persistence, or pivot to connected services
  • Availability could be affected through destructive or resource-intensive actions

General mitigation guidance

Mitigation generally focuses on ensuring that field-layout input remains data-only and cannot control executable object construction.

Common defensive patterns include:

  • Applying strict allowlist-based schemas to field-layout elements
  • Canonicalizing and validating JSON values before any object creation or event registration
  • Rejecting unexpected class names, behavior definitions, and handler specifications
  • Avoiding dynamic object instantiation from user-controlled values
  • Separating control-panel permissions so only trusted administrators can modify layouts
  • Running the application with least-privilege filesystem, database, and service access
  • Treating authenticated control-panel input as untrusted and enforcing server-side validation

How teams detect issues like this

Organizations can look for this vulnerability class through:

  • Static analysis rules identifying dynamic object-construction calls that consume request or JSON-derived values
  • Code review checks for cleansing that occurs after parsing, normalization, or object instantiation
  • Tests using unexpected string-typed layout elements and verifying strict rejection
  • Monitoring for unusual field-layout changes, behavior definitions, or event-handler values
  • Policy enforcement requiring allowlisted schemas and prohibiting user-controlled class resolution
  • Neutral automated code-review or software-composition tools that flag unsafe dynamic instantiation patterns

Sources

SourceLink
github.comgithub.com/craftcms/cms/security/advisories/GHSA-qj4v-m29p-fj4m
vulncheck.comvulncheck.com/advisories/craft-cms-5.0.0-rc1-before-5.10.12-behavior-injection-rce

Frequently asked

questions

It may be exploitable through the Craft control panel when the attacker can authenticate and reach functionality that accepts or modifies affected field-layout data. Direct unauthenticated exploitation is not implied by the described behavior.

The attacker generally needs a valid control-panel account with sufficient permissions to submit or change field-layout elements. The practical scope depends on configured roles and administrative controls.

Treat field-layout JSON as untrusted data, enforce a strict allowlist schema, reject executable behavior definitions, and ensure dynamic object creation cannot be influenced by request-derived values.

Use server-side validation before every processing stage, minimize layout-management privileges, test parser and object-construction boundaries, and monitor sensitive configuration changes.

Find out what's already
exploitable in your codebase.