CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-25498

Crafting Chaos: RCE in Craft CMS via Yii2 Behavior Injection

Alon Barad
Alon Barad
Software Engineer

Feb 9, 2026·6 min read·121 visits

Executive Summary (TL;DR)

Authenticated RCE in Craft CMS (v4/v5). The `fieldLayout` parameter allows attackers to inject Yii2 Behaviors into object creation. By attaching `AttributeTypecastBehavior`, an attacker can trigger shell commands during server-side validation. Patch immediately to v5.8.22 or v4.16.18.

A high-severity Remote Code Execution (RCE) vulnerability exists in Craft CMS versions 4 and 5, specifically within the `assembleLayoutFromPost` method. The flaw stems from the unsafe usage of the Yii2 framework's dependency injection container, allowing authenticated administrators to inject malicious configuration arrays. By leveraging Yii2 'Behaviors,' attackers can achieve arbitrary code execution during object instantiation, effectively turning the CMS against its host server.

The Hook: Magic Methods, Magic Misery

If you've ever worked with the Yii2 framework (the engine purring underneath Craft CMS), you know it loves 'magic.' It has magic properties, magic events, and a dependency injection (DI) container that feels like wizardry. You pass it an array, and poof, it hands you a fully instantiated object with properties set, event listeners attached, and behaviors mixed in.

But here's the thing about magic: if you let a stranger cast the spells, you're going to have a bad time. CVE-2026-25498 is the result of exactly that—letting the user (even an authenticated one) dictate the configuration array passed to Craft::createObject().

This isn't a simple buffer overflow or a logic error. This is Object Injection via configuration. It's the PHP equivalent of handing someone a loaded gun and asking them to hold it while you tie your shoes. The specific vulnerability lies in how Craft CMS handles field layouts. When an admin saves a layout, the application takes a JSON blob from the request and feeds it directly into the object factory. If you know the right incantations (read: Yii2 internal classes), you can turn that JSON blob into a remote shell.

The Flaw: Trusting the 'Admin' Badge

The vulnerability lives in src/services/Fields.php, inside the assembleLayoutFromPost function. The purpose of this function is mundane: it reconstructs a Field Layout object based on data sent from the browser. It's supposed to take a JSON structure defining where fields go on the screen and hydrate a PHP object representing that layout.

Here is where the developer's optimism clashed with reality. The code assumed that because the user is an authenticated administrator, they wouldn't try to blow up the server.

Technically, the flaw is CWE-470: Use of Externally-Controlled Input to Select Classes or Code. The application accepts a raw JSON string from the fieldLayout POST parameter, decodes it into a PHP array, and passes that array straight into createLayout, which eventually calls Craft::createObject($config).

In Yii2, if a configuration array contains a key starting with as , the framework treats it as a Behavior attachment. Behaviors are mixins that can inject methods and properties into a class at runtime. If you control the behavior, you control the object's lifecycle. And if you control the lifecycle, you can hook into events like EVENT_AFTER_VALIDATE to execute code.

The Code: A Game of 'Spot the Difference'

Let's look at the smoking gun. This is the code running in src/services/Fields.php before the patch. Note the absolute lack of sanitization:

public function assembleLayoutFromPost(?string $namespace = null): FieldLayout
{
    $paramPrefix = $namespace ? rtrim($namespace, '.') . '.' : '';
    
    // VULNERABLE: Takes raw user input, decodes it, and creates an object.
    // There is no check on what keys exist in this JSON.
    $config = Json::decode(Craft::$app->getRequest()->getBodyParam($paramPrefix . 'fieldLayout'));
    
    return $this->createLayout($config);
}

The fix is painfully simple but highlights the root cause perfectly. The developers wrapped the input in ComponentHelper::cleanseConfig(). This helper method was actually introduced to fix a previous similar vulnerability (CVE-2025-68455). It seems they missed this specific spot during the first sweep—a classic case of 'Whack-a-Mole' security.

public function assembleLayoutFromPost(?string $namespace = null): FieldLayout
{
    $paramPrefix = $namespace ? rtrim($namespace, '.') . '.' : '';
    
    // PATCHED: The config is now scrubbed for dangerous keys before use.
    $config = ComponentHelper::cleanseConfig(
        Json::decode(Craft::$app->getRequest()->getBodyParam($paramPrefix . 'fieldLayout'))
    );
    
    return $this->createLayout($config);
}

What does cleanseConfig do? It recursively iterates through the array and nukes any key that starts with as (behaviors) or on (event handlers). It effectively neuters the magic, forcing the array to be treated as just data, not instructions.

The Exploit: Building the Gadget Chain

So, we can attach a behavior. Now what? We need a "gadget"—a class already present in the codebase that does something dangerous when we poke it. Enter yii\behaviors\AttributeTypecastBehavior.

This class is designed to automatically convert model attributes to specific types (e.g., integer, string). However, it allows you to define a callback for the conversion. If we tell it to convert the uid attribute using the passthru function, it will execute passthru($uid).

Here is the attack chain:

  1. Injection: We inject a configuration for AttributeTypecastBehavior using the as rce key.
  2. Trigger: We configure the behavior to run on typecastAfterValidate. This means the code executes automatically when the system tries to validate the layout object (which happens immediately upon save).
  3. Payload: We set the attributeTypes map to link a harmless looking property (like uid) to a system command executor (like passthru or system).
  4. Execution: We provide the command we want to run as the value of uid.

The Payload:

{
  "as rce": {
    "class": "yii\\behaviors\\AttributeTypecastBehavior",
    "attributeTypes": {
      "uid": "passthru"
    },
    "typecastAfterValidate": true
  },
  "uid": "id; uname -a"
}

When the server receives this, it creates the object, attaches the behavior, sets uid to id; uname -a, validates the object, triggers the event, and executes the shell command. The server response might hang or return the output, depending on how passthru interacts with the output buffer, but the damage is done.

The Impact: From Admin to God Mode

You might be thinking, "But you need to be an Admin to do this!" You are correct. This is an authenticated vulnerability (CVSS PR:H). However, in the real world, this is a catastrophic escalation.

Compromising a CMS admin account is often trivial. Admins reuse passwords. Admins get phished. Admins leave sessions open. In a standard scenario, an attacker with admin access can deface a site or steal customer data. With this vulnerability, they get root (or at least www-data) on the web server.

Once code execution is achieved, the attacker can:

  • Install a persistent webshell.
  • Pivot to the internal network.
  • Exfiltrate environment variables (AWS keys, database credentials).
  • Deploy ransomware.

This turns a "website problem" into an "infrastructure problem." It completely invalidates the security model of the application.

The Fix: Scrubbing the Input

If you are running Craft CMS 4 or 5, you need to update immediately. The fix is included in versions 5.8.22 and 4.16.18.

If you cannot update right now (perhaps you're locked in a change freeze or your dev team is on vacation), you can try to mitigate this at the WAF level. Block any POST request to /admin/* that contains the JSON substring "as followed by a generic alphanumeric string. However, WAF rules for JSON are notoriously brittle and prone to bypasses (e.g., using unicode escapes).

The real fix is the patch. The cleanseConfig method is the only reliable way to ensure that user input—even from trusted admins—cannot instantiate dangerous framework internals. This serves as a reminder to all PHP developers: Never pass user-controlled arrays to unserialize or Dependency Injection containers without strict allow-listing.

Official Patches

Craft CMSOfficial patch commit

Fix Analysis (1)

Technical Appendix

CVSS Score
8.6/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Affected Systems

Craft CMS 4.x (< 4.16.18)Craft CMS 5.x (< 5.8.22)

Affected Versions Detail

Product
Affected Versions
Fixed Version
Craft CMS
Pixel & Tonic
>= 4.0.0-RC1, < 4.16.184.16.18
Craft CMS
Pixel & Tonic
>= 5.0.0-RC1, < 5.8.225.8.22
AttributeDetail
CVE IDCVE-2026-25498
CVSS v4.08.6 (High)
CWECWE-470 (Unsafe Reflection)
Attack VectorNetwork (Authenticated)
ImpactRemote Code Execution (RCE)
Vulnerable Componentsrc/services/Fields.php
Exploit StatusPoC Available

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.003Command and Scripting Interpreter: Windows Command Shell
Execution
T1203Exploitation for Client Execution
Execution
CWE-470
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')

The application uses externally-controlled input to select the class or code to be executed, which can be manipulated to execute malicious code.

Known Exploits & Detection

GitHub Security AdvisoryDetailed advisory with payload examples

Vulnerability Timeline

Initial fix for related CVE-2025-68455
2025-12-05
Patch committed for CVE-2026-25498
2026-01-09
Advisory Published
2026-02-09

References & Sources

  • [1]GHSA-7jx7-3846-m7w7
  • [2]Related Vulnerability (CVE-2025-68455)
Related Vulnerabilities
CVE-2025-68455

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
11 views•10 min read
•2 days ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
14 views•12 min read
•2 days ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
6 views•12 min read
•2 days ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
16 views•10 min read
•2 days ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
19 views•10 min read
•2 days ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
8 views•9 min read