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-61453

CVE-2026-61453: Stored Cross-Site Scripting via Twig String Concatenation Bypass in Grav CMS

Alon Barad
Alon Barad
Software Engineer

Sep 17, 2026·7 min read·45 visits

Executive Summary (TL;DR)

A stored XSS vulnerability in Grav CMS before v2.0.1 allows attackers with page-write permissions to bypass blueprint validation filters using Twig string concatenation. The vulnerability is fixed in version 2.0.1 by introducing a post-render scanning step.

Grav CMS before v2.0.1 contains a security bypass vulnerability in its blueprint validation logic. The XSS detection routine, Security::detectXss(), was executed on raw page contents prior to Twig engine processing. When Twig processing is enabled for editor-authored page content, an attacker can dynamically reconstruct harmful HTML elements, attributes, or protocols using string concatenation (e.g. `{{ 'on' ~ 'error' }}`). When compiled, the benign source converts into active XSS payloads, which are rendered to the client browser via raw filters. This vulnerability was resolved in version 2.0.1 by adding a post-render validation backstop.

Vulnerability Overview

Grav CMS is an open-source, flat-file content management system that relies on a modular architecture and Twig templating for page rendering. To prevent Cross-Site Scripting (XSS) attacks, the system utilizes a custom validation class, Security::detectXss(), to scan incoming content before saving pages. However, a structural limitation exists because this verification takes place during the blueprint validation phase, which exclusively inspects raw input before template compile cycles.

When Twig processing is enabled for page content through the twig_content.process_enabled directive, the input can contain both markdown markup and Twig syntax. An attacker with page-write API permissions can exploit this sequence by structuring Twig code that dynamically generates HTML tags, attributes, or protocols during template execution. Because the input validation occurs before Twig compiles the template, the raw code appears entirely benign to the security filters.

Upon template execution, the Twig engine resolves the dynamic expressions into executable HTML payloads. Because Grav prints page content through unescaped filters, specifically {{ page.content|raw }}, the browser executes the compiled payload, leading to stored Cross-Site Scripting. This flaw is tracked as CVE-2026-61453 and GHSA-2c4f-86xc-cr74.

Root Cause Analysis

The root cause of this vulnerability lies in the sequence of operations within the content rendering pipeline of Grav CMS. The application performs input sanitization at the wrong stage of the lifecycle. By analyzing raw input files prior to template parsing, the system exposes an evasion surface where compiled assets are never re-evaluated.

During the blueprint validation phase, Grav processes input using standard regex checks inside Security::detectXss(). This validator identifies common XSS signatures such as <script> tags, dangerous JavaScript protocols like javascript:, and HTML event attributes including onerror or onload. This approach relies on the assumption that the input matches the final output structure.

This assumption fails when the page content contains template instructions. Twig allows string operations, variable substitution, and character concatenation. An attacker can write template statements like {{ "on" ~ "error" }} or <s{{ "c"~"r"~"i"~"p"~"t" }}>. To the raw string scanner, these represent harmless Twig syntax, bypassing validation. When the compiler evaluates the templates, the server dynamically pieces together the forbidden elements and generates the malicious HTML payload, which is then rendered directly into the browser.

Code Analysis

In vulnerable versions of Grav CMS, the Page::content() method retrieves, caches, and processes markdown and Twig templates. When Twig processing is requested, the application executes $this->processTwig() without tracking the origin or trust level of the template source. Crucially, the system does not recheck the compiled HTML output of the Twig engine for security policy violations.

The patch resolves this gap by introducing a post-render validation check. When the system executes Twig templates sourced from user input, the application now forwards an evaluation flag $scan_twig_xss. After compiling the template, the updated code executes Security::detectXss() directly on the generated HTML string.

The following code diff shows the implementation of this validation check in system/src/Grav/Common/Page/Page.php:

// Editor-authored content Twig (gated by process_enabled) gets its
// rendered output re-scanned for XSS; trusted modular/theme Twig
// does not. (GHSA-2c4f-86xc-cr74)
$scan_twig_xss = $content_twig_requested && $content_twig_allowed;
$process_twig = $scan_twig_xss || $this->modularTwig();
 
// ... inside content generation pipeline ...
if ($process_twig) {
    $this->processTwig($scan_twig_xss);
}
 
// Inside modified processTwig function:
private function processTwig(bool $scanXss = false)
{
    /** @var Twig $twig */
    $twig = Grav::instance()['twig'];
    $this->content = $twig->processPage($this, $this->content);
 
    if ($scanXss && is_string($this->content) && $this->content !== ''
        && (bool) Grav::instance()['config']->get('security.twig_content.xss_scan_output', true)) {
        $found = Security::detectXss($this->content);
        if ($found !== null) {
            Security::logTwigContentXssBlocked((string) ($this->route() ?? $this->filePath() ?? 'unknown'), $found);
            $this->content = '';
        }
    }
}

This post-render check serves as an effective control because it intercepts the payload after all Twig evaluations are completed but before the HTML is sent to the client. If any prohibited element is identified within $this->content, the rendering process logs the event and sets the content to an empty string.

Exploitation Methodology

To exploit this vulnerability, an attacker must have privileges to write or edit pages within the Grav CMS installation, or exploit an API endpoint that permits page modification. The host must also have the twig_content.process_enabled directive set to true to force Twig compilation on page elements.

The attacker structures a payload designed to construct executable Javascript from benign components. The easiest method leverages Twig's concatenation operator (~). By breaking down restricted words into separate string segments, the attacker evades static regex evaluation during the initial save.

{# Exploiting attribute detection using string concatenation #}
<img src="invalid_image.jpg" {{ "on" ~ "error" }}="alert(document.domain)">
 
{# Exploiting tag detection by assembling the tag name #}
<s{{ "c" ~ "r" ~ "i" ~ "p" ~ "t" }}>alert(document.domain)</s{{ "c" ~ "r" ~ "i" ~ "p" ~ "t" }}>
 
{# Exploiting protocol filters using inline string evaluation #}
<a href="{{ "java" ~ "script" }}:alert(1)">Click to continue</a>

When an administrator or visitor navigates to the modified page, the server executes the Twig processor. The rendered response contains the assembled HTML fragments, executing the script payloads in the context of the user's browser session.

Here is a diagram representing the vulnerability and validation bypass flow:

Impact Assessment

The security impact of CVE-2026-61453 is substantial, matching the standard risks associated with stored Cross-Site Scripting. Since the payload is stored within the page content on the file system, every user visiting the affected page will execute the injected script.

If an administrative user visits the compromised page, the attacker can execute administrative actions. This includes creating new admin accounts, modifying site configurations, or installing malicious plugins. In flat-file CMS architectures like Grav, possessing administrator access often permits arbitrary file uploads, which can be leveraged to write PHP backdoors and achieve remote code execution (RCE) on the underlying server.

For general visitors, the vulnerability can be used to perform browser session hijacking, steal session tokens, or execute drive-by attacks. The vulnerability carries a CVSS v4.0 score of 5.1 and a CVSS v3.x score of 6.1. Although the prerequisite requires page-authoring or write permissions, any vulnerability that allows lower-privileged users or API integrations to execute script in the administrative context presents a significant path to full system compromise.

Remediation & Defensive Guidance

The primary remediation path is upgrading the Grav CMS installation to version 2.0.1 or higher, which implements the post-render validation check. If an immediate upgrade is not possible, administrators should evaluate security policies and apply mitigation settings.

First, verify that the Twig content processing configuration is disabled if it is not strictly required. The configuration can be modified in /user/config/security.yaml by applying the following settings:

twig_content:
  process_enabled: false

If Twig processing must remain enabled, manually apply the post-render scan configuration to the site's configuration. Ensure that the xss_scan_output parameter is explicitly configured:

twig_content:
  process_enabled: true
  xss_scan_output: true

Furthermore, configure web application firewalls (WAF) to detect Twig-specific delimiters and concatenation characters (~) within page modification API calls. This step adds an extra layer of defense against dynamic bypass techniques.

Official Patches

getgravOfficial patch fixing the XSS blueprint validation bypass.
getgravOfficial security advisory for GHSA-2c4f-86xc-cr74 / CVE-2026-61453.

Fix Analysis (1)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
EPSS Probability
0.26%
Top 82% most exploited

Affected Systems

Grav CMS installations prior to version 2.0.1

Affected Versions Detail

Product
Affected Versions
Fixed Version
grav
getgrav
< 2.0.12.0.1
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork
CVSS v3.1 Score6.1 (Medium)
EPSS Score0.00263 (Percentile: 18.26%)
ImpactStored Cross-Site Scripting (XSS) / Account Takeover
Exploit StatusPoC (Proof of Concept) available
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The application does not neutralize or incorrectly neutralizes user-controlled input before rendering it as HTML, enabling attackers to execute malicious scripts in client browsers.

Vulnerability Timeline

Vulnerability patched in Grav CMS repository
2026-02-12
GitHub Security Advisory (GHSA-2c4f-86xc-cr74) published
2026-02-12
CVE-2026-61453 record assigned and published
2026-02-13

References & Sources

  • [1]GHSA-2c4f-86xc-cr74: XSS Bypass via Twig String Concatenation
  • [2]Grav Commit - Patch for GHSA-2c4f-86xc-cr74
  • [3]VulnCheck Advisory: Grav XSS via Twig String Concatenation
  • [4]CVE-2026-61453 CVERecord

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

•1 minute ago•CVE-2026-126357
5.3

CVE-2026-126357: Authentication Bypass via Mount Path Transformation in Hono

CVE-2026-126357 (GHSA-4m76-xfj5-7975) is an authentication bypass vulnerability in the Hono web application framework prior to version 4.13.16. The flaw resides in the prefix-stripping and URL reconstruction logic of `app.mount()` and the `mount()` middleware. Two distinct path transformation errors—static route-pattern length slicing on dynamic prefixes and URL normalization of decoded pathnames—create a routing discrepancy between the outer Hono router and the mounted sub-application. An unauthenticated attacker can exploit these discrepancies to bypass outer authentication or authorization middleware and access protected inner routes directly.

Amit Schendel
Amit Schendel
0 views•9 min read
•about 1 hour ago•CVE-2026-126356
5.3

CVE-2026-126356: Multipart Form Validation Bypass in Hono Web Framework

A parser differential vulnerability exists in the Hono web application framework versions 4.5.1 prior to 4.13.16. The built-in form validation middleware (`validator('form')`) utilizes an overly restrictive regular expression to evaluate the HTTP `Content-Type` header for `multipart/form-data` payloads. When a client supplies additional valid MIME parameters (such as `charset=utf-8`) or multiple whitespace characters following a semicolon delimiter, the regular expression fails to match. Consequently, the validator passes an empty object to the validation callback instead of the parsed form fields. If the validation logic permits empty objects or only checks for disallowed values on optional properties, the request passes validation, allowing downstream route handlers calling `c.req.parseBody()` or `c.req.formData()` to process unvalidated user input.

Amit Schendel
Amit Schendel
2 views•10 min read
•about 2 hours ago•CVE-2026-126355
5.3

CVE-2026-126355: Cross-Site Request Forgery Protection Bypass via Hyperlink Auditing in Hono

CVE-2026-126355 (GHSA-46wx-v44x-9hh2) is a Cross-Site Request Forgery (CSRF) validation bypass in Hono, a web application framework for JavaScript runtimes. Prior to version 4.13.16, Hono's built-in csrf() middleware only evaluated origin headers for requests matching standard HTML form MIME types (application/x-www-form-urlencoded, multipart/form-data, and text/plain). By leveraging the HTML anchor ping attribute in Chromium-based browsers, an attacker can initiate an unprompted, credentialed cross-origin HTTP POST request with Content-Type: text/ping without triggering a CORS preflight request. Because text/ping was omitted from the middleware regular expression, requests bypassed Origin and Sec-Fetch-Site verification, allowing unauthorized state-changing operations.

Amit Schendel
Amit Schendel
4 views•9 min read
•about 3 hours ago•CVE-2026-128067
8.4

CVE-2026-128067: Out-of-Bounds Heap Read and Write in Pillow libtiff Encoder via Geometry Tag Overrides

CVE-2026-128067 is a memory corruption vulnerability in Pillow (versions 2.3.0 through 12.3.0) occurring when saving compressed TIFF images via the underlying libtiff encoder. By supplying crafted image geometry tags through exif=, tiffinfo=, or a source TIFF IFD, an attacker can override the scanline dimensions configured in libtiff while Pillow allocates the internal row buffer based strictly on the physical image dimensions. This mismatch induces an out-of-bounds heap read during scanline encoding, and escalates to an out-of-bounds heap write when TIFF Predictor 2 (horizontal differencing) is enabled.

Amit Schendel
Amit Schendel
2 views•10 min read
•about 4 hours ago•CVE-2026-128066
8.7

CVE-2026-128066: Quadratic Memory Amplification Denial of Service in Pillow TIFF and EXIF IFD Parser

CVE-2026-128066 (GHSA-wqgw-9xfh-qf2g) is a resource allocation vulnerability (CWE-770) in the Python Pillow imaging library affecting versions 1.0 through 12.3.0. The flaw resides in the ImageFileDirectory_v2.load() method within src/PIL/TiffImagePlugin.py, which processes Tag Image File Format (TIFF) structures and Exchangeable Image File Format (EXIF) metadata across multiple container formats. By supplying an image with thousands of IFD tag entries that point to overlapping or identical file offsets, an attacker can trigger quadratic memory amplification (O(N * filesize)). Because the vulnerability occurs during metadata parsing rather than pixel decoding, it bypasses Pillow's built-in decompression bomb protections (Image.MAX_IMAGE_PIXELS).

Amit Schendel
Amit Schendel
3 views•13 min read
•about 5 hours ago•CVE-2026-126081
7.5

CVE-2026-126081: Strong Parameters Bypass via Parameters#each_key in Ruby on Rails Action Pack

CVE-2026-126081 is a mass-assignment vulnerability (CWE-915) in the Action Pack component of Ruby on Rails. Prior to versions 8.1.4.1 and 8.0.5.2, the ActionController::Parameters#each_key method was delegated directly to the internal ActiveSupport::HashWithIndifferentAccess instance holding raw request parameters. When invoked with a block, #each_key returned the underlying unpermitted hash rather than the ActionController::Parameters wrapper instance. Applications that pass the return value of #each_key directly into Active Model mass-assignment methods bypass Strong Parameters enforcement, allowing attackers to modify restricted model attributes.

Amit Schendel
Amit Schendel
4 views•9 min read