Summary
Craft CMS contains an incomplete blocklist in the handling of entry type title formats, allowing an attacker with the ability to author those formats to abuse the non-sandboxed template renderer. This can enable arbitrary file writes to the web document root and may lead to remote code execution.
Affected context
The issue affects Craft CMS versions from 5.0.0 up to, but not including, 5.11.4. It occurs when entry type title formats are rendered through the non-sandboxed renderObjectTemplate() renderer and the incomplete blocklist permits use of file-writing functionality such as ZipArchive or XMLWriter.
Exploit preconditions
- Attack surface: Entry type title format authoring and subsequent template rendering
- Required access: Ability to author or modify an entry type title format
- Trigger point: Rendering the affected title format
- Why exploitation is possible: The renderer is not sandboxed, and the incomplete blocklist does not prevent access to classes that can write files
Why this happens
The underlying issue is insufficient restriction of functionality available to an attacker-influenced template. Because renderObjectTemplate() is non-sandboxed, and the blocklist does not fully exclude file-writing classes, crafted title formats can cause attacker-controlled content to be written to files. This is a code injection weakness mapped to CWE-94.
Potential impact
- An attacker may write or overwrite files in the web document root.
- Attacker-controlled files could enable remote code execution.
- The application and its data could be compromised.
- Compromise of the application could provide a foothold for further attacks, depending on deployment permissions.
General mitigation guidance
Defensive patterns include isolating template rendering from powerful runtime capabilities and using a sandbox or restricted template language by default. Treat authored title formats as untrusted input, enforce narrow allowlists of permitted operations, and avoid relying on incomplete blocklists. Limit the application process's filesystem write access, especially within the web document root, and apply least privilege to runtime components.
How teams detect issues like this
- Review template-rendering paths for non-sandboxed evaluation of user- or author-controlled content.
- Use static analysis and code review to identify blocklists that govern access to file-writing or other sensitive classes.
- Monitor application and filesystem activity for unexpected writes to web-accessible directories.
- Enforce policies that restrict template capabilities and filesystem permissions.
Automated code review tools may help flag unsafe rendering patterns and sensitive class access.

