CVE-2026-28697

Craft Affected by Authenticated RCE via "craft.app.fs.write()" in Twig Templates

Published Mar 4, 2026 CVSS 4.0 · 9.4 Critical EPSS 1.4% KEV · Not listed
Description
Craft is a content management system (CMS). Prior to 4.17.0-beta.1 and 5.9.0-beta.1, an authenticated administrator can achieve Remote Code Execution (RCE) by injecting a Server-Side Template Injection (SSTI) payload into Twig template fields (e.g., Email Templates). By calling the craft.app.fs.write() method, an attacker can write a malicious PHP script to a web-accessible directory and subsequently access it via the browser to execute arbitrary system commands. This vulnerability is fixed in 4.17.0-beta.1 and 5.9.0-beta.1.

Analysis

AI-generated

Technical impact

The flaw is a server‑side template injection that lets an authenticated administrator inject code into Twig template fields such as email templates. By calling the craft.app.fs.write() function, the attacker can write a malicious PHP script to a public directory and later execute it, giving arbitrary system‑command execution on the host. The weakness is identified as CWE‑1336 and the impact is the complete compromise of confidentiality, integrity, and availability of the affected website.

Affected Systems

CraftCMS Craft CMS content management system. All 4.x releases prior to 4.17.0‑beta.1 and all 5.x releases prior to 5.9.0‑beta.1 expose the vulnerability. If a site is running any version of Craft CMS that has not yet applied the update, it is affected.

Risk and Exploitability

This critical condition scores 9.4 on CVSS; the EPSS probability is lower than 1%, and the vulnerability is not yet listed in the CISA KEV catalog. The only prerequisite for exploitation is an authenticated administrator account, after which an attacker can inject an SSTI payload into any writable Twig field. The craft.app.fs.write() call then creates a PHP script in a publicly accessible directory, which can be invoked via the browser to run arbitrary commands. Delaying patching could leave a site open to complete takeover by exploiting this flaw.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Craft CMS to version 4.17.0‑beta.1 or later, or 5.9.0‑beta.1 or later.
  • Disable or restrict the craft.app.fs.write() capability in Twig templates so that only non‑administrator users can use it.
  • Audit existing templates for injection vectors and remove any suspicious or malicious content.

Generated by OpenCVE AI on April 17, 2026 at 13:10 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-v47q-jxvr-p68x Craft CMS Vulnerable to Authenticated RCE via "craft.app.fs.write()" in Twig Templates
History
Type Values Removed Values Added
First Time appeared Craftcms craft Cms
CPEs cpe:2.3:a:craftcms:craft_cms:*:*:*:*:*:*:*:*
cpe:2.3:a:craftcms:craft_cms:4.0.0:-:*:*:*:*:*:*
cpe:2.3:a:craftcms:craft_cms:4.0.0:rc1:*:*:*:*:*:*
cpe:2.3:a:craftcms:craft_cms:4.0.0:rc2:*:*:*:*:*:*
cpe:2.3:a:craftcms:craft_cms:4.0.0:rc3:*:*:*:*:*:*
cpe:2.3:a:craftcms:craft_cms:5.0.0:-:*:*:*:*:*:*
cpe:2.3:a:craftcms:craft_cms:5.0.0:rc1:*:*:*:*:*:*
Vendors & Products Craftcms craft Cms
Metrics cvssV3_1

{'score': 9.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H'}

Type Values Removed Values Added
First Time appeared Craftcms
Craftcms craftcms
Vendors & Products Craftcms
Craftcms craftcms
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Craft is a content management system (CMS). Prior to 4.17.0-beta.1 and 5.9.0-beta.1, an authenticated administrator can achieve Remote Code Execution (RCE) by injecting a Server-Side Template Injection (SSTI) payload into Twig template fields (e.g., Email Templates). By calling the craft.app.fs.write() method, an attacker can write a malicious PHP script to a web-accessible directory and subsequently access it via the browser to execute arbitrary system commands. This vulnerability is fixed in 4.17.0-beta.1 and 5.9.0-beta.1.
Title Craft Affected by Authenticated RCE via "craft.app.fs.write()" in Twig Templates
Weaknesses CWE-1336
References
Metrics cvssV4_0

{'score': 9.4, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H'}

Weaknesses
  • CWE-1336

    Improper Neutralization of Special Elements Used in a Template Engine

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Mar 6, 2026, 5:01 AM
Reserved
Mar 2, 2026, 9:43 PM
Status
Analyzed
Published
Mar 4, 2026, 5:16 PM
Modified
Jun 17, 2026, 10:28 AM