CVE-2026-50281: Craftcms/cms Craft CMS's Mass Assignment Vulnerability
HIGHCVE-2026-50281 is a HIGH craft cms's mass assignment vulnerability (CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes) affecting Craftcms/cms libraries in the Packagist ecosystem. The issue involves craft cms's mass assignment via id in newattributes during bulk duplicate overwrites existing elements. Remediation is available by upgrading affected packages to version 5.9.21.
CVE-2026-50281 at a Glance
How to Fix CVE-2026-50281
To remediate this vulnerability, upgrade all affected Craftcms/cms dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade craftcms/cms to 5.9.21
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for craftcms/cms
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-50281, inspect your project dependencies for Craftcms/cms:
inspect dependencies for craftcms/cms
Analyze the terminal output to locate any version of Craftcms/cms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.9.21), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes, where the product receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified. In Craftcms/cms, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-50281 Affected Craftcms/cms Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
craftcms/cms
|
Packagist |
≥ 5.7.0
< 5.9.21
|
5.9.21
|
References
Frequently Asked Questions
What is CVE-2026-50281?
Which Craftcms/cms versions are affected?
What version fixes CVE-2026-50281?
Is craftcms/cms affected?
What CWE is associated with CVE-2026-50281?
How can I check Packagist dependencies for CVE-2026-50281?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x5m4-g2cq-52pq",
"modified" : "2026-07-02T20:03:36Z",
"published" : "2026-07-02T20:03:36Z",
"aliases" : [ "CVE-2026-50281" ],
"summary" : "Craft CMS's mass assignment via id in newAttributes during bulk duplicate overwrites existing elements",
"details" : "## Summary\n\nThere is a mass-assignment flaw in the bulk-duplicate element action. Alice, holding only the permission to duplicate an entry she owns, submits an arbitrary `id` through the `newAttributes` request parameter. The duplication routine overrides its own `id = null` reset with that value and writes Alice’s attributes into Bob’s existing entry row.\n\n## Details\n\n`ElementsController::beforeAction()` (`src/controllers/ElementsController.php:119-124`) pulls the request body into `$this->_attributes` and rejects requests that ship an `id` or `canonicalId` key at the top level:\n\n```php\n$this->_attributes = $this->request->getBodyParams();\n\n// No funny business\nif (isset($this->_attributes['id']) || isset($this->_attributes['canonicalId'])) {\n throw new BadRequestHttpException('Changing an element’s ID is not allowed.');\n}\n```\n\nThe check inspects only the top-level payload. `actionBulkDuplicate()` (`src/controllers/ElementsController.php:1708-1749`) reads a separate `newAttributes` array and passes it straight through to the service layer:\n\n```php\n$elementInfo = $this->request->getRequiredBodyParam('elements');\n$newAttributes = $this->request->getRequiredBodyParam('newAttributes');\n...\n$safeNewAttributes = Collection::make($newAttributes)\n ->only($element->safeAttributes())\n ->all();\n...\n$newElement = $elementsService->duplicateElement(\n $element,\n $safeNewAttributes + $element::baseBulkDuplicateAttributes(),\n false,\n checkAuthorization: true,\n);\n```\n\n`Elements::duplicateElement()` (`src/services/Elements.php:1814-1840`) clones the source element, sets `id` to null, and then hands the attacker's array to `Craft::configure()`:\n\n```php\n$mainClone = clone $element;\n$mainClone->id = null;\n$mainClone->uid = StringHelper::UUID();\n...\nCraft::configure($mainClone, ArrayHelper::merge(\n $newAttributes,\n $siteAttributes[$mainClone->siteId] ?? [],\n));\n```\n\n`Craft::configure()` overwrites the reset `id` with any numeric value inside `$newAttributes`. Yii's `saveElement()` then performs an UPDATE against the row with that primary key instead of an INSERT. Alice's title, slug, authorId, postDate, and UID land on Bob’s entry.\n\n`safeAttributes()` on `Entry` includes `id` because the base element model exposes it, so the `Collection::only()` filter does not strip it.\n\n## Impact\n\nA low-privileged author overwrites any other element (entries, categories, users that share the Entry element table inheritance) by predicting or enumerating element IDs. Content integrity on the entire install breaks. The attack requires only the ability to duplicate one entry Alice already owns.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "craftcms/cms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.7.0"
}, {
"fixed" : "5.9.21"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/craftcms/cms/security/advisories/GHSA-x5m4-g2cq-52pq"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-50281"
}, {
"type" : "WEB",
"url" : "https://github.com/craftcms/cms/commit/8f6587c25050bbb6e080d59c71f6bb8932fc8600"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/craftcms/cms"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-915" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-02T20:03:36Z",
"nvd_published_at" : "2026-07-02T17:17:00Z"
}
}