Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. craftcms/cms
  4. ›
  5. CVE-2026-31857

CVE-2026-31857: CraftCMS has an RCE vulnerability via relational conditionals in the control panel

March 11, 2026

A Remote Code Execution vulnerability exists in the Craft CMS 5 conditions system.

The BaseElementSelectConditionRule::getElementIds() method passes user-controlled string input through renderObjectTemplate() – an unsandboxed Twig rendering function with escaping disabled.

Any authenticated Control Panel user (including non-admin roles such as Author or Editor) can achieve full RCE by sending a crafted condition rule via standard element listing endpoints.

This vulnerability requires no admin privileges, no special permissions beyond basic control panel access, and bypasses all production hardening settings (allowAdminChanges: false, devMode: false, enableTwigSandbox: true).

Users should update to the patched 5.99 release to mitigate the issue.

References

  • github.com/advisories/GHSA-fp5j-j7j4-mcxc
  • github.com/craftcms/cms
  • github.com/craftcms/cms/commit/8d4903647dcfd31b8d40ed027e27082013347a80
  • github.com/craftcms/cms/security/advisories/GHSA-fp5j-j7j4-mcxc
  • nvd.nist.gov/vuln/detail/CVE-2026-31857

Code Behaviors & Features

Detect and mitigate CVE-2026-31857 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 4.0.0-beta.1 before 4.17.4, all versions starting from 5.0.0-RC1 before 5.9.9

Fixed versions

  • 5.9.9
  • 4.17.4

Solution

Upgrade to versions 4.17.4, 5.9.9 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-94: Improper Control of Generation of Code ('Code Injection')

Source file

packagist/craftcms/cms/CVE-2026-31857.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 24 Mar 2026 12:18:12 +0000.