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

CVE-2026-58657: Stored CSS Injection in Grav CMS Media Resize Parser

Alon Barad
Alon Barad
Software Engineer

Sep 17, 2026·4 min read·11 visits

Executive Summary (TL;DR)

Low-privileged editors can inject arbitrary CSS via image resize query parameters due to missing type validation in Grav's media processing trait.

CVE-2026-58657 is a critical stored CSS injection vulnerability in Grav CMS's media processing pipeline. By exploiting improper sanitization of image dimensions in the resize helper, low-privileged users with page editing permissions can inject arbitrary CSS styles. This can lead to visual defacement, UI redressing, and indirect data exfiltration.

Vulnerability Overview

Grav CMS is a flat-file content management system that processes content written in Markdown. Within its media pipeline, users can append query parameters to image references to perform dynamic manipulations, such as resizing, cropping, or scaling.

The vulnerability, designated as CVE-2026-58657, resides within the media manipulation handler. Specifically, when parsing the resize parameter, the system fails to sanitize or validate the dimensions supplied in the URL query string.

This lack of sanitization allows an attacker with page creation or editing privileges to insert raw CSS syntax. Because the generated dimensions are directly written to inline style attributes, this results in stored CSS injection when the page is rendered for other users.

Root Cause Analysis

The root cause of this vulnerability lies in the lack of type verification within the resize() method. This method is implemented inside the StaticResizeTrait trait, located at system/src/Grav/Common/Media/Traits/StaticResizeTrait.php.

During Markdown processing, Grav extracts query parameters from image URLs and forwards them to Excerpts::processMediaActions(). When the resize action is processed, the raw width and height strings are assigned directly to the internal $styleAttributes array.

Because the input values are concatenated directly with the 'px' string without casting to integers, any character sequence containing semicolons is preserved. Semicolons act as delimiters in CSS, enabling an attacker to terminate the width property and append arbitrary CSS properties to the inline style block.

Code Analysis

A comparison of the vulnerable and patched code reveals how the input validation check was missing. In the vulnerable version, the parameters are handled as raw variables:

public function resize($width = null, $height = null)
{
    if ($width) {
        $this->styleAttributes['width'] = $width . 'px';
    }
    // ...
}

The fix introduces strict validation by verifying if the values are numeric and casting them to integers. This neutralizes any non-numeric characters before they are added to the inline style array:

$width = is_numeric($width) ? (int) $width : 0;
$height = is_numeric($height) ? (int) $height : 0;
 
if ($width > 0) {
    $this->styleAttributes['width'] = $width . 'px';
} else {
    unset($this->styleAttributes['width']);
}

This validation ensures that only positive integer values are rendered inside the final style attribute. Non-numeric inputs evaluate to 0 and are completely discarded, preventing the inject path.

Exploitation Methodology

To exploit this vulnerability, an attacker must have permissions to create or modify pages within the Grav CMS instance. This restriction makes the threat vector post-authentication, though achievable by users with low-privilege roles such as content editors or contributors.

The attacker crafts an image tag within the Markdown editor containing a malformed resize parameter. An example payload structures the query parameter to include a semicolon followed by positioning directives:

![Target](image.png?resize=100;position:fixed;top:0;left:0;width:100%;height:100%;z-index:9999;background:red;,200)

When processed by the server, the template parser renders an image tag with a corrupted inline style attribute. The browser parses the semicolon as a delimiter, overriding the layout with a full-screen block on top of the original interface. This visual overlay can be customized to display deceptive content.

Impact Assessment

The impact of this vulnerability is centered around UI redressing and potential credential theft. While CSS injection does not execute arbitrary JavaScript directly, modern CSS features allow sophisticated manipulation of the user interface.

Attackers can utilize absolute positioning and high z-index elements to craft phishing forms over the legitimate administration interface. When an administrator views the page, they may interact with the fake form, unknowingly submitting sensitive inputs to an external server.

Additionally, CSS attribute selectors can be used to exfiltrate sensitive tokens. By utilizing background image URLs that trigger conditionally based on input attributes, an attacker could leak CSRF tokens or user-typed data to an out-of-band logger.

Remediation & Mitigation

The primary remediation path is to update the Grav CMS installation to version 2.0.0 or higher. This release integrates the type-casting logic in the StaticResizeTrait class to completely block the injection path.

If upgrading is not immediately possible, administrators should manually apply the code-level patch to the StaticResizeTrait.php file. This involves casting the input parameters to integers before they are evaluated or appended to style arrays.

In addition, implementing a strict Content Security Policy can restrict the impact of CSS injection. Configuring the style-src directive without 'unsafe-inline' prevents the execution of arbitrary inline style rules, though it may affect normal operation if inline styles are required by the theme.

Fix Analysis (2)

Technical Appendix

CVSS Score
6.5/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
EPSS Probability
0.37%
Top 69% most exploited

Affected Systems

Grav CMS

Affected Versions Detail

Product
Affected Versions
Fixed Version
Grav CMS
Trilby Media
< 2.0.02.0.0
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork
CVSS Score6.5
EPSS Score0.00371
ImpactStored CSS Injection
Exploit Statusnone
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')

References & Sources

  • [1]GitHub Security Advisory GHSA-ffmg-hfvg-jhg9
  • [2]NVD - CVE-2026-58657

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

•about 9 hours ago•CVE-2026-118777
4.8

CVE-2026-118777: Prototype Pollution in Forge HTTP Client Cookie Management

CVE-2026-118777 is a prototype pollution vulnerability (CWE-1321) in the Forge JavaScript cryptography and networking library (distributed on npm as node-forge) prior to version 1.4.1. The flaw resides in the forge.http client subsystem, where incoming HTTP cookie names and paths parsed from Set-Cookie response headers are stored directly into standard JavaScript objects without key validation or property isolation. By returning crafted Set-Cookie headers containing keys such as __proto__ or constructor, a malicious HTTP server can inject arbitrary properties into Object.prototype, attach attributes to the global Object constructor, or delete built-in prototype methods to cause an application-wide denial of service.

Amit Schendel
Amit Schendel
6 views•10 min read
•about 10 hours ago•CVE-2026-118775
3.7

CVE-2026-118775: ASN.1 OID First Arc Truncation and Ambiguity in node-forge

CVE-2026-118775 (GHSA-4642-5mcj-2rqw) is an integer overflow and validation flaw in the ASN.1 serialization module of Forge (node-forge) prior to version 1.4.1. The asn1.oidToDer() function fails to validate the range of the first two arcs of an Object Identifier (OID) and truncates the packed initial subidentifier to a single 8-bit integer. Applications that perform policy checks on untrusted OID strings before encoding them into Distinguished Encoding Rules (DER) format can be tricked into emitting DER bytes that correspond to a completely different, restricted OID.

Amit Schendel
Amit Schendel
7 views•10 min read
•about 11 hours ago•CVE-2026-119194
7.5

CVE-2026-119194: Algorithmic Complexity Denial of Service in pyasn1 Schemaless ASN.1 Decoder

CVE-2026-119194 is an algorithmic complexity vulnerability (CWE-407) in the pyasn1 library for Python, affecting versions 0.3.3 through 0.6.4. The flaw resides in the schemaless decoding routine ConstructedPayloadDecoderBase._decodeComponentsSchemaless used across BER, CER, and DER codecs. By sending an ASN.1 container populated with child components whose tag identifiers are separated by multiples of CPython's integer hash modulus (sys.hash_info.modulus), an unauthenticated attacker can force worst-case hash collisions in an unbounded Python set, degrading decoding performance from O(N) to O(N^2) and causing a Denial of Service (DoS).

Alon Barad
Alon Barad
6 views•9 min read
•about 12 hours ago•CVE-2026-119195
7.5

CVE-2026-119195: Quadratic-Time Denial of Service in pyasn1 BER/CER/DER Decoders

CVE-2026-119195 is an algorithmic complexity vulnerability (CWE-407) in the pyasn1 library for Python, affecting all versions prior to 0.6.5. When decoding constructed strings or indefinite-length ANY types across BER, CER, and certain DER code paths, the payload decoders repeatedly concatenate incoming fragments onto an immutable bytes object using the += operator. Because Python bytes objects cannot be resized in-place, each fragment iteration allocates a new buffer and copies all previously accumulated bytes, resulting in quadratic O(N^2) time and memory copy complexity. An unauthenticated remote attacker can supply a highly fragmented ASN.1 stream to exhaust CPU cycles and stall application worker threads.

Amit Schendel
Amit Schendel
7 views•10 min read
•about 13 hours ago•CVE-2026-119197
7.5

CVE-2026-119197: Quadratic Algorithmic Complexity Denial of Service in pyasn1 REAL Mantissa Decoder

An algorithmic complexity vulnerability (CWE-407) in pyasn1 versions prior to 0.6.5 allows unauthenticated attackers to cause a Denial of Service (DoS) via crafted ASN.1 payloads. The flaw resides in the binary-encoded ASN.1 REAL mantissa deserialization routine within RealPayloadDecoder.valueDecoder. By performing iterative byte-string slicing and repeated bitwise shifts on a growing arbitrary-precision integer, the decoder exhibits quadratic time and memory allocation complexity relative to the mantissa length. Supplying a BER-, CER-, or DER-encoded payload with a large REAL mantissa causes excessive CPU consumption and blocks application worker processes.

Amit Schendel
Amit Schendel
7 views•10 min read
•about 14 hours ago•CVE-2026-119196
7.5

CVE-2026-119196: Quadratic CPU Consumption in pyasn1 Constructed BIT STRING Decoding

A vulnerability classified under CWE-407 (Inefficient Algorithmic Complexity) exists in the pyasn1 library prior to version 0.6.5. When parsing constructed ASN.1 BIT STRING payloads under BER, CER, or schema-driven DER encoding rules, the BitStringPayloadDecoder repeatedly shifts and copies the entire accumulated bit value for each incoming fragment. Processing inputs with a large number of small constructed fragments induces quadratic CPU consumption, allowing unauthenticated remote attackers to cause a denial of service via resource exhaustion during the initial decoding phase.

Alon Barad
Alon Barad
8 views•10 min read