cve.bz

CVE-2026-31857 craftcms craft cms: Code Injection

8.1 highEPSS 1.1%Fix available

High (8.1) in craftcms craft cms. EPSS 1.1% estimated probability of exploitation activity in the next 30 days. Fixed in craftcms/cms 4.17.4, 5.9.9.

On this page
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.

Severity

CVSS 4.0

8.1 high
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

CVSS 3.1

8.8 high
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS
1.1% (unchanged from 1.1% a week ago; 0.9% 30 days ago) estimated probability of exploitation activity in the next 30 days; 67th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: yes · Technical impact: total, assessed 2026-03-12. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-94 Improper Control of Generation of Code (Code Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2026-31857 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2026-31857?via=ask-ai-copy and https://cve.bz/cve/CVE-2026-31857?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2026-31857 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
craftcms:craft_cmsfrom 4.0.0.1 before 4.17.4
craftcms:craft_cmsfrom 5.0.1 before 5.9.9
craftcms:craft_cms4.0.0
craftcms:craft_cms4.0.0:beta1
craftcms:craft_cms4.0.0:beta2
craftcms:craft_cms4.0.0:beta3
craftcms:craft_cms4.0.0:beta4
craftcms:craft_cms4.0.0:rc1
craftcms:craft_cms4.0.0:rc2
craftcms:craft_cms4.0.0:rc3
craftcms:craft_cms5.0.0
craftcms:craft_cms5.0.0:rc1

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-fp5j-j7j4-mcxcPackagistcraftcms/cms>=5.0.0-RC1 <5.9.95.9.9
GHSA-fp5j-j7j4-mcxcPackagistcraftcms/cms>=4.0.0-beta.1 <4.17.44.17.4

GitHub PoC

Repositories on GitHub named after this CVE or listed for it by the PoC-in-GitHub index. For those marked Harbor Check: matches CVE, Flawharbor read the code and found it implements this CVE's exploitation technique: read, not run, and its dependencies only checked for warning signs, so a pointer and no guarantee. The rest are unverified: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it. How Harbor Check reads them, and what it found.

  • kaizoku73/CVE-2026-31857-PoC Harbor Check: matches CVE 1 star, Python, created
    Proof of Concept for CVE-2026-31857, an authenticated Remote Code Execution vulnerability in Craft CMS caused by unsafe processing of user-…
  • 0Asylum/CVE-2026-31857 Harbor Check: matches CVE 1 star, Python, created
    CraftCMS has an RCE vulnerability via relational conditionals in the control panel
  • WhiteMachin3/CVE-2026-31857 Harbor Check: matches CVE 0 stars, Python, created
    CVE-2026-31857 - Craft CMS authenticated RCE timing verifier.
  • 0xTatsuki/CVE-2026-31857 Harbor Check: matches CVE 0 stars, Python, created
    Craft CMS RCE via relational conditionals in the control panel
  • TRX-0/CVE-2026-31857-craftcms-ssti Harbor Check: matches CVE 0 stars, Python, created

Attack patterns (CAPEC)

  • CAPEC-35 Leverage Executable Code in Non-Executable Files Likelihood: High · Severity: Very High
  • CAPEC-77 Manipulating User-Controlled Variables Likelihood: High · Severity: Very High
  • CAPEC-242 Code Injection Likelihood: High · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON