The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-31857

CVE-2026-31857: Craft CMS RCE Vulnerability

CVE-2026-31857 is a remote code execution flaw in Craft CMS that allows authenticated users to execute arbitrary code through the conditions system. This article covers technical details, affected versions, and mitigation.

Published: March 13, 2026

CVE-2026-31857 Overview

CVE-2026-31857 is a Remote Code Execution (RCE) vulnerability affecting Craft CMS, a popular content management system. The vulnerability exists within the conditions system where the BaseElementSelectConditionRule::getElementIds() method passes user-controlled string input through renderObjectTemplate() — an unsandboxed Twig rendering function with escaping disabled. This allows any authenticated Control Panel user, including non-admin roles such as Author or Editor, to achieve full remote code execution by sending a crafted condition rule via standard element listing endpoints.

Critical Impact

Authenticated users with basic Control Panel access can execute arbitrary code on the server, bypassing all production hardening settings including allowAdminChanges: false, devMode: false, and enableTwigSandbox: true.

Affected Products

  • Craft CMS versions prior to 5.9.9
  • Craft CMS versions prior to 4.17.4

Discovery Timeline

  • 2026-03-11 - CVE-2026-31857 published to NVD
  • 2026-03-12 - Last updated in NVD database

Technical Details for CVE-2026-31857

Vulnerability Analysis

This vulnerability is classified as CWE-94 (Improper Control of Generation of Code), commonly referred to as Code Injection. The flaw resides in how Craft CMS processes element selection condition rules within its conditions system. The BaseElementSelectConditionRule::getElementIds() method accepts user-controlled input and passes it directly to renderObjectTemplate(), which performs Twig template rendering without sandboxing or proper escaping.

The critical aspect of this vulnerability is that it requires no administrative privileges — any authenticated user with basic Control Panel access can exploit it. Furthermore, the vulnerability bypasses all production hardening configurations, making even properly secured Craft CMS installations susceptible to attack.

Root Cause

The root cause is the use of an unsandboxed Twig rendering function (renderObjectTemplate()) to process user-controlled input in the BaseElementSelectConditionRule class. The function renders Twig templates without enabling the security sandbox, allowing attackers to inject and execute arbitrary Twig code that can be leveraged for server-side code execution.

Attack Vector

The attack is network-based and requires authentication to the Craft CMS Control Panel. An attacker with any level of Control Panel access (Author, Editor, or similar roles) can craft a malicious condition rule payload and submit it through standard element listing endpoints. The payload is processed by the vulnerable getElementIds() method, which renders the attacker-controlled input as a Twig template, resulting in arbitrary code execution on the server.

php
// Vulnerable code path (before patch)
// src/base/conditions/BaseElementSelectConditionRule.php
             } else {
                 $referenceElement = new stdClass();
             }
-            return Craft::$app->getView()->renderObjectTemplate($elementId, $referenceElement);
+            return Craft::$app->getView()->renderSandboxedObjectTemplate($elementId, $referenceElement);
         }
         return $this->_elementId;
     }

Source: GitHub Commit Reference

The fix replaces the unsandboxed renderObjectTemplate() call with renderSandboxedObjectTemplate(), ensuring that user-controlled input is processed within Twig's security sandbox.

Detection Methods for CVE-2026-31857

Indicators of Compromise

  • Unusual or malformed requests to element listing endpoints containing Twig template syntax (e.g., {{ }} or {% %})
  • Unexpected process spawning or system command execution from the web server process
  • Anomalous file system modifications or creation of new files outside expected Craft CMS directories
  • Authentication logs showing non-admin users accessing element condition endpoints with unusual payloads

Detection Strategies

  • Monitor web application logs for requests containing Twig template injection patterns in condition rule parameters
  • Implement Web Application Firewall (WAF) rules to detect and block Server-Side Template Injection (SSTI) payloads
  • Enable and review Craft CMS application logs for unusual template rendering errors or exceptions
  • Deploy endpoint detection to identify unexpected child processes spawned by the web server

Monitoring Recommendations

  • Establish baseline behavior for Control Panel users and alert on deviations in endpoint access patterns
  • Configure real-time alerting for any execution of system commands from the PHP process context
  • Review and audit all non-admin user accounts with Control Panel access
  • Implement file integrity monitoring on critical server directories

How to Mitigate CVE-2026-31857

Immediate Actions Required

  • Update Craft CMS to version 5.9.9 or 4.17.4 immediately to apply the security patch
  • Audit Control Panel access logs for any suspicious activity from authenticated users
  • Review and restrict Control Panel access to only essential personnel until patching is complete
  • Consider temporarily disabling non-admin Control Panel access if immediate patching is not possible

Patch Information

The vulnerability has been addressed in Craft CMS versions 5.9.9 and 4.17.4. The patch modifies the BaseElementSelectConditionRule::getElementIds() method to use renderSandboxedObjectTemplate() instead of the unsandboxed renderObjectTemplate() function. For detailed patch information, refer to the GitHub Security Advisory and the commit implementing the fix.

Workarounds

  • Restrict Control Panel access to trusted IP addresses using firewall rules or .htaccess configuration
  • Temporarily revoke Control Panel access for non-essential users until patching is complete
  • Implement additional authentication layers (e.g., VPN requirement) for Control Panel access
  • Deploy WAF rules to filter potential SSTI payloads targeting element listing endpoints
bash
# Example: Restrict Craft CMS Control Panel access by IP in nginx
location /admin {
    allow 192.168.1.0/24;  # Trusted internal network
    allow 10.0.0.50;       # Specific admin IP
    deny all;
    try_files $uri $uri/ /index.php?$query_string;
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechCraft Cms

  • SeverityHIGH

  • CVSS Score8.1

  • EPSS Probability0.18%

  • Known ExploitedNo
  • CVSS 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/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-94
  • Technical References
  • GitHub Commit Reference

  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-33157: Craftcms Craft CMS RCE Vulnerability

  • CVE-2026-32264: Craft CMS Behavior Injection RCE Vulnerability

  • CVE-2026-32261: Webhooks for Craft CMS RCE Vulnerability

  • CVE-2026-28783: Craft CMS RCE Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English