CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-55792

CVE-2026-55792: Sensitive File Disclosure in Craft CMS via Twig Sandbox Bypass

Amit Schendel
Amit Schendel
Senior Security Researcher

Jul 6, 2026·6 min read·24 visits

Executive Summary (TL;DR)

Low-privileged users with template customizer access can read sensitive local files like `.env` using a sandbox bypass, leading to full database credential and security key compromise.

CVE-2026-55792 represents a sensitive file disclosure vulnerability in Craft CMS. The issue arises from the inclusion of the `dataUrl()` function in the Twig sandbox allowlist combined with incomplete path validation inside the underlying helper method. Attackers with low-privileged control panel access can exploit this flaw to read and exfiltrate the `.env` configuration file.

Vulnerability Overview

Craft CMS incorporates a template-rendering pipeline driven by the Twig template engine. To permit restricted site administrators or users with specific administrative delegation to construct localized system messages or transactional notifications, the application implements a dedicated Twig sandbox environment. This sandbox is strictly governed by an allowlist that evaluates functions, filters, and tags before execution.\n\nIn vulnerable configurations of Craft CMS, the utility function dataUrl() was registered as an allowable function within the sandbox definition context. The intended use of this helper is to allow the rendering of visual assets, such as brand logos, by encoding them directly into the output content of transactional emails. The vulnerability lies in the fact that the underlying helper implementation did not sufficiently restrict file resolution paths, thereby opening a vector for arbitrary file disclosure.\n\nAn authenticated user with the utility:system-messages permission can exploit this exposure. By inserting a reference to sensitive local files inside a customized template, the attacker forces the system to serialize the files and render them as inline assets. The severity is high because this mechanism completely bypasses typical web server document root limitations.

Root Cause Analysis

The root cause of CVE-2026-55792 is situated within the validation logic of the craft\\helpers\\Html::dataUrl() method combined with its presence in the sandbox allowlist. When Twig processes the sandboxed function, it maps directly to this static helper. The developer's intention was to restrict the function to non-sensitive assets residing within the application directory.\n\nTo enforce this restriction, the helper evaluated paths against three primary defensive boundaries. First, it checked if the target file path resolved within the project's root filesystem structure. Second, it executed directory containment checks to verify that the file was not located inside critical subdirectories such as config/, vendor/, storage/, or templates/. Third, it restricted the reading of any file carrying a .php file extension to prevent source code exposure.\n\nThis validation model failed to account for files that do not possess a standard extension and are positioned at the top level of the project root. The .env environment file resides directly in the root directory, placing it outside the blacklist of specific subdirectories. Furthermore, because it utilizes a dotfile format without a .php suffix, it completely evades the extension blacklist. The validation logic consequently validates the path as safe and proceeds to call PHP's file_get_contents() function.

Code Analysis

Analyzing the vulnerable code path reveals how the path validation logic allows dotfiles to pass unchecked. The following code snippet demonstrates the vulnerability in src/helpers/Html.php and the subsequent patch introduced to address the flaw:\n\nphp\n// VULNERABLE IMPLEMENTATION\npublic static function dataUrl(string $path, ?string $mimeType = null): string\n{\n $resolvedPath = FileHelper::resolvePath($path);\n \n if (self::isRestrictedDirectory($resolvedPath) || str_ends_with($resolvedPath, '.php')) {\n throw new InvalidArgumentException('Access denied to specified file.');\n }\n \n $content = file_get_contents($resolvedPath);\n return 'data:' . $mimeType . ';base64,' . base64_encode($content);\n}\n\n\nThe corresponding patch alters the behavior by removing dataUrl() from the Twig sandbox completely and introducing strict extension validations. Below is the updated validation architecture implemented in the patch:\n\nphp\n// PATCHED IMPLEMENTATION\npublic static function dataUrl(string $path, ?string $mimeType = null): string\n{\n $resolvedPath = FileHelper::resolvePath($path);\n $basename = basename($resolvedPath);\n \n if (\n str_starts_with($basename, '.') ||\n self::isRestrictedDirectory($resolvedPath) ||\n !self::isAllowedExtension($resolvedPath)\n ) {\n throw new InvalidArgumentException('Access to the requested file is prohibited.');\n }\n \n $content = file_get_contents($resolvedPath);\n return 'data:' . $mimeType . ';base64,' . base64_encode($content);\n}\n\n\nmermaid\ngraph LR\n A["Twig Template Evaluation"] --> B{"Is dataUrl Allowed?"}\n B -- "Yes (Vulnerable)" --> C["Evaluate Path"]\n B -- "No (Patched)" --> H["Block Execution"]\n C --> D{"Is in config/ or vendor/?"}\n D -- "No" --> E{"Does it end in .php?"}\n E -- "No" --> F["file_get_contents('.env')"]\n F --> G["Base64 Encode & Exfiltrate"]\n\n\nAdditionally, the patch removes the registration of dataUrl from the twig-sandbox.php configuration file. This multi-layered remediation ensures that even if the helper's internal validation were bypassed in future iterations, the function is no longer accessible inside sandboxed Twig contexts.

Exploitation Methodology

Exploitation of CVE-2026-55792 requires low-privileged administrative access. Specifically, the target user session must possess the utility:system-messages permission, which authorizes the customization of system transactional emails. The attacker leverages this level of access to embed malicious templates directly into the application database.\n\nOnce logged into the control panel, the attacker navigates to the System Messages utility. By selecting an active template, such as the user registration or password reset message, the attacker appends the payload {{ dataUrl('.env') }} inside a hidden HTML tag or within the readable message body. Saving this template commits the payload to the database.\n\nTo trigger exfiltration, the attacker executes the transaction associated with the edited template. If the password reset template was modified, the attacker requests a password reset for any registered email. The backend task runner processes the request, renders the Twig template, reads the .env configuration file, encodes the content, and delivers the email to the recipient mailbox. The attacker decodes the resulting base64 payload to access cleartext credentials.

Impact Assessment

The security impact of successful exploitation is critical, as it exposes the entire application configuration layer. The .env file containing database credentials, mail server settings, and system-wide secrets is read in its entirety. This results in complete exposure of sensitive application datastores.\n\nMost significantly, the exfiltration of the CRAFT_SECURITY_KEY facilitates immediate privilege escalation. This key is used by the framework to sign security cookies, validate session tokens, and sign CSRF payloads. Armed with the CRAFT_SECURITY_KEY, an attacker can forge administrative cookies locally, authenticate as a super-administrator, and execute arbitrary commands or install malicious plugins, leading to full host compromise.\n\nBecause the template rendering occurs on the server side, firewalls and external network defenses are bypassed. The attack relies entirely on legitimate internal application pathways to exfiltrate the data. Consequently, standard network-level intrusion detection systems will not flag the transaction as anomalous.

Remediation and Defense

Remediation requires upgrading Craft CMS to version 4.18.0 or 5.10.0 depending on the active deployment track. These updates remove the dataUrl helper from the default Twig sandbox configuration and add robust validation checks to the underlying PHP class. Upgrades should be executed via Composer using standard dependency management workflows.\n\nIf upgrading cannot be executed immediately, administrators must manually mitigate the risk. The primary workaround is to revoke the utility:system-messages permission from all users who do not have absolute administrative trust. This cuts off the initial entry point required to inject the malicious Twig string.\n\nAdditionally, administrators can override the default sandbox configuration. By modifying the local config/twig-sandbox.php file, developers can explicitly remove dataUrl from the allowed functions array. Regular database audits should be conducted on the systemmessages table to ensure no unexpected template modifications exist.

Technical Appendix

CVSS Score
6.0/ 10
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
EPSS Probability
0.27%
Top 82% most exploited

Affected Systems

Craft CMS 4.xCraft CMS 5.x

Affected Versions Detail

Product
Affected Versions
Fixed Version
Craft CMS
craftcms
>= 4.0.0-RC1, < 4.18.04.18.0
Craft CMS
craftcms
>= 5.0.0-RC1, < 5.10.05.10.0
AttributeDetail
CWE IDCWE-200
Attack VectorNetwork
CVSS 4.0 Score6.0
EPSS Score0.00268
ImpactSensitive Information Disclosure / Local File Read
Exploit StatusPoC in technical advisories
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1005Data from Local System
Collection
T1552Unsecured Credentials
Credential Access
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an actor who is not authorized to have access to that information.

Known Exploits & Detection

GitHub Security AdvisoryExplains how the sandboxed Twig utility is abused with dataUrl

Vulnerability Timeline

Vulnerability published and advisory issued
2026-07-01
NVD publication date for CVE-2026-55792
2026-07-02

References & Sources

  • [1]GitHub Security Advisory GHSA-287w-mxq6-x2cp
  • [2]Craft CMS Pull Request 18559

More Reports

•about 14 hours ago•CVE-2026-62898
7.5

CVE-2026-62898: Use After Free Information Disclosure in Microsoft QUIC

A critical use-after-free vulnerability in Microsoft QUIC allows unauthenticated remote attackers to disclose sensitive system memory over the network. The vulnerability is caused by a race condition during rapid connection termination and asynchronous packet retransmission.

Alon Barad
Alon Barad
10 views•6 min read
•about 15 hours ago•CVE-2026-62899
5.9

CVE-2026-62899: .NET Security Feature Bypass Vulnerability (HTTP Request Smuggling)

CVE-2026-62899 is a security feature bypass vulnerability in the Microsoft .NET runtime environment on non-Windows platforms. The flaw manifests as an HTTP Request/Response Smuggling vulnerability (CWE-444) within the managed implementation of the System.Net.HttpListener class. This allows unauthenticated remote attackers to desynchronize request boundaries when the backend .NET application is hosted behind an upstream reverse proxy.

Amit Schendel
Amit Schendel
15 views•6 min read
•about 16 hours ago•CVE-2026-62901
7.5

CVE-2026-62901: Remote Denial of Service via Infinite Loop in .NET WebSockets Engine

CVE-2026-62901 is a high-severity Denial of Service (DoS) vulnerability in the Microsoft .NET ecosystem, specifically affecting the System.Net.WebSockets frame-processing engine and associated network transports. Under certain circumstances, a remote, unauthenticated attacker can exploit this vulnerability by sending malformed or specifically crafted WebSocket packets over the network, causing a targeted .NET application server to enter a tight infinite loop. This behavior results in 100% CPU utilization on the executing thread, starving application resources and leading to a complete Denial of Service.

Alon Barad
Alon Barad
13 views•6 min read
•about 17 hours ago•CVE-2026-62909
7.8

CVE-2026-62909: .NET Local Elevation of Privilege via Unchecked Diagnostic Socket Permissions

A high-severity Local Elevation of Privilege (EoP) vulnerability exists in the Microsoft .NET runtime and Visual Studio on Unix-like platforms. The flaw arises from an unchecked return value (CWE-252) during the initialization of the Diagnostics Inter-Process Communication (IPC) socket. By exploiting this vulnerability, a low-privileged local attacker can execute arbitrary commands with the privileges of a higher-privileged .NET process.

Alon Barad
Alon Barad
20 views•6 min read
•about 18 hours ago•CVE-2026-70354
7.8

CVE-2026-70354: Out-of-Bounds Write in .NET Windows Presentation Foundation Subsystem

CVE-2026-70354 is a high-severity local code execution vulnerability affecting multiple versions of the Microsoft .NET runtime, .NET Framework, and Microsoft Visual Studio. The vulnerability is located within the Windows Presentation Foundation (WPF) layout and rendering subsystems, specifically within the parsing and rasterization of complex graphical layouts, XPS files, or custom font structures.

Alon Barad
Alon Barad
17 views•7 min read
•about 19 hours ago•CVE-2026-62897
7.0

CVE-2026-62897: Integer Overflow and Code Execution in .NET WPF and WinForms

An integer overflow vulnerability (CWE-190) exists in the layout and rendering engines of the Microsoft .NET Framework and .NET Core. This flaw resides within the processing of complex coordinate maps, font tables, and image metadata in Windows Presentation Foundation (WPF) and Windows Forms (WinForms). By convincing a user to open a crafted vector graphic or layout document, a local attacker can exploit this arithmetic error to induce an undersized memory allocation, leading to a heap-based buffer overflow and subsequent arbitrary code execution within the context of the vulnerable application.

Alon Barad
Alon Barad
11 views•6 min read