CVE-2023-44382
Executive Summary
CVE-2023-44382 is a critical sandbox escape vulnerability in October CMS affecting authenticated backend users with specific content editor permissions. When cms.safe_mode is enabled, users with editor.cms_pages, editor.cms_layouts, or editor.cms_partials permissions are expected to be restricted from executing PHP code; however, a crafted Twig template can escape the Twig sandbox and execute arbitrary PHP code on the server. This vulnerability carries a CVSS score of 9.1 and has been patched in version 3.4.15. Given that the affected component is the CMS backend, exploitation requires prior authentication, but any authenticated user with backend editor access to pages, layouts, or partials can leverage this flaw to achieve full remote code execution, resulting in complete server compromise.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
October CMS implements a cms.safe_mode configuration option designed to prevent users with content-editing permissions from executing arbitrary PHP code through template files. This is an administrative control mechanism intended to allow non-developer users to manage CMS content (pages, layouts, and partials) without granting them full code execution privileges. The safety boundary is enforced through the Twig templating engine's sandbox extension, which restricts access to dangerous functions, classes, and PHP constructs.
The vulnerability arises from an incomplete sandbox configuration within the Twig environment used by October CMS. PHP-based CMS platforms commonly allow Twig templates to invoke PHP functions, utility classes, and internal CMS APIs. The Twig sandbox operates on a denylist/allowlist model: it restricts access to PHP functions, object methods, and static calls unless explicitly permitted. However, sandbox bypasses of this nature typically leverage one of the following attack mechanisms:
- Inherited methods and parent classes: Calling a method on a child class that is defined in a parent class not covered by the sandbox's method allowlist, thereby circumventing method-level restrictions.
- Object chaining and property access: Accessing safe-looking objects that expose dangerous internal properties or methods when chained, allowing the attacker to reach sensitive classes (e.g., filesystem, process execution) not explicitly blocked.
- Static method calls on whitelisted classes: Invoking static methods on classes that are permitted in the template context but whose static methods expose dangerous functionality (e.g., file operations, command execution).
- Abuse of
__call,__get, or__toStringmagic methods: Triggering magic methods that internally perform dangerous operations not directly visible to the sandbox.
The CNA title specifically refers to a "Twig sandbox escape" — a phrase describing the ability of an attacker to break out of the sandbox restrictions and execute code outside the controlled template evaluation context. Since October CMS templates are rendered server-side with full PHP interpreter access (subject to the sandbox), escaping the sandbox is functionally equivalent to arbitrary PHP code execution.
The attack surface is the backend CMS editor interface. The attack requires an authenticated session with at least one of the three content-editing permissions: editor.cms_pages, editor.cms_layouts, or editor.cms_partials. Any of these permissions grants the ability to create or modify Twig template files through the web-based editor. The crafted payload — malicious Twig code — is stored within the template content and executed when the page, layout, or partial is rendered to site visitors or during preview.
The CVSS vector (inferred from the 9.1 score and the vulnerability characteristics) reflects a network-exploitable, low-complexity attack requiring low privileges with no user interaction, resulting in a scope change with high impact on confidentiality, integrity, and availability. Notably, the cms.safe_mode mechanism was specifically designed to prevent this class of attack, making this a control-bypass vulnerability that undermines a security boundary within the CMS.
Exploitation Scenarios
Step 1 — Reconnaissance and Target Identification. An attacker first identifies October CMS instances with version 3.4.14 or earlier. This can be accomplished via HTTP fingerprinting (e.g., the CMS version exposed in the admin interface or in HTTP response headers), via the /backend admin panel login page, or by reviewing publicly exposed content that reveals the CMS signature. The attacker also identifies whether the target has cms.safe_mode enabled — a configuration that may be inferred from the tenant's security posture or determined after a low-privilege account is obtained.
Step 2 — Authentication and Privilege Verification. The attacker must obtain valid backend credentials for an account with editor.cms_pages, editor.cms_layouts, or editor.cms_partials permissions. This may be achieved through credential stuffing, phishing, weak-password attacks, or prior compromise of a lower-privilege account. The backend login at the admin URL (usually under /backend) is the entry point. Once logged in, the attacker confirms their account has one of the required editor permissions by accessing the CMS editor pages.
Step 3 — Payload Injection via Twig Sandbox Escape. The attacker navigates to the page, layout, or partial editor and crafts a Twig template containing the sandbox-escape payload. The specific Twig code constructs an object chain or invokes method calls that bypass the Twig sandbox's allowlist. Because the description does not specify the exact internal classes or functions used in the sandbox escape, the payload is constructed at the vulnerability-class level: a Twig expression that accesses an object (available within the template context) and chains its methods or properties to reach a PHP construct capable of executing arbitrary code (e.g., filesystem manipulation or process execution). The malicious template is saved, replacing or augmenting the legitimate template content.
Step 4 — Code Execution and Post-Exploitation. The stored malicious template is triggered when the affected page, layout, or partial is rendered. This may occur when a site visitor loads the page, when the admin previews the content, or when the CMS runs any background task that renders templates. At render time, the Twig sandbox escape executes arbitrary PHP code with the web server's privileges (typically www-data or equivalent). Post-exploitation impact includes full server compromise: reading sensitive configuration files (database credentials, application keys), establishing a web shell or reverse shell, lateral movement within the hosting environment, data exfiltration, and ransomware deployment.
No public PoC exists for this CVE (POC_STATUS: None), and no exploit code has been released. The attack chain is inferred from the NVD description and the vulnerability class. The EPSS score of 0.00873 indicates a low immediate probability of exploitation in the wild, although this metric can change as public technical details emerge.
Impact Assessment
The CVSS score of 9.1 places this vulnerability in the "Critical" severity band, signifying catastrophic impact potential. The vector reflects a scope change (S:C) — a compromise of the target server can affect other resources beyond the vulnerable component. High confidentiality, integrity, and availability scores (C:H/I:H/A:H) indicate total compromise of all three security pillars.
Business Impact. An authenticated backend user with basic content-editing privileges can escalate to arbitrary code execution on the server. This affects organizations that use October CMS for public websites, corporate portals, intranet applications, or e-commerce platforms. The severity is amplified because the affected permissions (editor.cms_pages, editor.cms_layouts, editor.cms_partials) are commonly assigned to content editors, marketers, and non-technical staff — the largest group of backend users. Any single compromised account with these permissions leads to full server takeover.
Affected Components. All October CMS installations running versions below 3.4.15 with cms.safe_mode enabled are vulnerable. The safe mode feature is specifically designed for environments where non-developer users manage content — exactly the environments where this vulnerability is most impactful. Organizations that have disabled cms.safe_mode are not protected by the feature boundary but may have different exposure profiles.
Blast Radius. The blast radius extends beyond the CMS itself: the web server can be fully compromised, granting access to the application's database, file system, environment variables, and any adjacent services sharing the server (e.g., email, other web applications on the same host, or the hosting control panel). In containerized or shared-hosting environments, scope creep to adjacent containers or tenants is possible.
Data Breach Consequences. For sites handling PII, payment data, or proprietary information, exploitation leads to data theft, regulatory non-compliance, and reputational damage. For organizations relying on CMS availability, the service can be taken offline (defacement, data destruction, ransomware).
Detection Guidance
Detection for this vulnerability focuses on identifying anomalous Twig template content in October CMS backend systems, unusual PHP code execution events on the server, and network traffic patterns associated with CMS exploitation.
Sigma Rule
title: October CMS Twig Sandbox Escape - Anomalous Template Content
id: a4f9d2c8-7e3b-4a1c-9b5f-3c6d8e2f1a0b
status: experimental
description: Detects editing of October CMS templates with content indicating Twig sandbox escape attempts
author: Valtersit Security Research
date: 2024/04/15
logsource:
category: application
product: octobercms
service: backend
detection:
selection:
event.action: template.update
template.type:
- cms_pages
- cms_layouts
- cms_partials
keywords:
- '{{'
- '{%'
filter_safe:
- '|esc'
- '|e('
condition: selection and keywords and not filter_safe
falsepositives:
- Legitimate template craftsmanship using advanced Twig features
- Administrators applying complex caching or theming logic
level: high
YARA Rule
rule OctoberCMS_Twig_Sandbox_Escape {
meta:
author = "Valtersit Security Research"
description = "Detects Twig templates with content characteristic of sandbox escape attempts targeting October CMS"
cve = "CVE-2023-44382"
date = "2024-04-15"
severity = "critical"
strings:
$a = "{{"
$b = "_self"
$c = "env.get"
$d = "createFunction"
$e = "system("
$f = "passthru("
$g = "exec("
$h = "shell_exec("
$i = "include("
$j = "require("
$k = "file_put_contents"
condition:
$a and any of ($c, $d, $e, $f, $g, $h, $i, $j, $k)
}
Suricata IDS Rule
alert http any any -> any any (msg:"CVE-2023-44382 October CMS Twig Sandbox Escape Attempt"; flow:established,to_server; http.uri; content:"/backend"; nocase; http.request_body; content:"twig"; nocase; content:"{{"; content:"env"; nocase; content:"system"; nocase; pcre:"/{{[^}]*?(env|_self|createFunction|system|shell_exec|passthru|exec|include|require)[^}]*?}}/i"; sid:202344382001; rev:1; reference:cve,2023-44382; metadata:attack_target_web_app, deployment_dmz, tag_cve-2023-44382, tag_twig_sandbox_escape;)
Elastic Detection
sequence by host.name with maxspan=5m
[any where process.name : "php*" and event.action : ("process_start", "exec") and process.args : ("*system*", "*shell_exec*", "*passthru*", "*exec*")]
[file where event.action == "write" and file.extension == "php" and file.path : ("*/storage/cms/*", "*/themes/*") and file.path : ("*pages*", "*partials*", "*layouts*") and file.size < 50000]
Splunk SPL Query
index=webserver sourcetype=access_combined OR sourcetype=iis
| where like(uri, "%/backend%")
| search "POST" AND "cms_pages" OR "cms_layouts" OR "cms_partials"
| rex field=_raw "(?<content>.*)\}"
| regex content="(?i)({{.*(env|_self|createFunction|system|shell_exec|passthru|exec|require|include).*}})"
| stats count by src_ip, uri, status, _time
| sort - _time
Wazuh OSSEC Rule
<rule id="100443" level="12">
<if_sid>3150</if_sid>
<match>october|twig|sandbox|safe_mode</match>
<regex>(\{\{.*(env|_self|createFunction|system|shell_exec|passthru|exec|include|require).*\}\})</regex>
<description>CVE-2023-44382: October CMS Twig sandbox escape attempt detected</description>
<group>october_cms, cve_2023_44382, twig_sandbox_escape,</group>
<mitre>
<id>T1190</id>
</mitre>
</rule>
Mitigation & Patch Guidance
Patch Confidence: 0/4 — UNPATCHED (no patch evidence from any tracked source, despite the NVD description stating a patch was released in 3.4.15; it is possible the NVD data is ahead of the tracked patch sources, and the vendor fix should be treated as version 3.4.15).
Immediate Mitigations (before patching):
- Restrict backend access to only essential personnel. Remove
editor.cms_pages,editor.cms_layouts, andeditor.cms_partialspermissions from all non-administrative accounts unless absolutely required for business operations. - Enforce multi-factor authentication (MFA) on all backend accounts, especially those with content-editing permissions, to prevent credential-compromise-based exploitation.
- Monitor backend login logs and template-edit logs for anomalous activity. Alert on new accounts, privilege escalation, and template modifications performed outside business hours.
- Harden the server: run the CMS with the least-privileged operating system user, enable file integrity monitoring on the CMS storage/cache directories, and use a Web Application Firewall (WAF) to filter backend requests containing
twig+systemorexecpatterns.
Patch / Upgrade Steps:
- Patch confidence is low — verify directly with the vendor whether version 3.4.15 (or later) is the official fix release. If confirmed, plan an immediate upgrade of all October CMS instances to version 3.4.15 or the latest stable release.
- Before upgrading, back up the application, database, and template files. Test the upgrade in a staging environment that mirrors production.
- After the upgrade, verify
cms.safe_modestill functions as expected by attempting to execute Twig code that previously triggered the sandbox escape.
Long-Term Hardening:
- Enforce a least-privilege model for all backend user roles. Content editors should not have access to template source files; provide them with structured content creation forms instead of raw template editing.
- If
cms.safe_modeis enabled, treat it as a defense-in-depth control — not a security boundary. Assume any user who can edit templates can eventually execute code. - Implement a vulnerability management program that subscribes to CVE feeds for October CMS and its dependencies (Twig, Symfony components) to ensure timely patching.
- Establish server-level monitoring for PHP code generation and execution anomalies. Audit all outbound connections from the web server to detect reverse-shell activity.
- Consider isolating the CMS backend (admin panel) from the public internet using VPN or IP allowlisting.
References
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2023-44382
- October CMS Official Site: https://octobercms.com — Vendor advisory and release notes for version 3.4.15
- October CMS GitHub Repository: https://github.com/octobercms/october — Source code and patch commits for the 3.4.15 release
- Twig Sandbox Documentation: https://twig.symfony.com/doc/3.x/api.html#sandbox-extension — Reference for the Twig sandbox mechanism that this vulnerability bypasses
- CISA KEV Catalog: Not listed (CISA KEV: NO) — No known exploitation-in-the-wild evidence at the time of writing; EPSS score 0.00873 (55.5% percentile) suggests current low exploitation likelihood
Threat Actor Intelligence: No known threat actor campaigns have been attributed to CVE-2023-44382 at the time of writing. The lack of public PoC and the requirement for authenticated access reduce the likelihood of widespread opportunistic exploitation. However, given the critical severity and the popularity of October CMS, targeted exploitation by advanced persistent threat (APT) groups targeting organizations using this CMS remains plausible, particularly in the context of web application supply-chain attacks or targeted intrusions against government and enterprise web properties.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.