CVE-2026-58657: Grav stored CSS injection in Markdown image resize action

CVE-2026-58657 · Severity: medium · CVSS 4.8 · Published 2026-07-08

Grav is a flat-file CMS that allows users to create and edit page content in Markdown. A lower-privileged content editor can embed specially crafted image URLs in page Markdown that inject arbitrary CSS declarations into the rendered HTML. When a higher-privileged user (reviewer or administrator) views or previews the page, the injected CSS executes in their browser context, enabling UI redress attacks, content manipulation, and phishing overlays without requiring JavaScript.

Technologies: Grav, getgrav/grav (Packagist). Vendors: Grav, Packagist.

Quick answers

Is CVE-2026-58657 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-58657 being exploited in the wild.
How severe is CVE-2026-58657?
Medium severity, with a CVSS score of 4.8, published 8 July 2026.
Which products and versions are affected?
Grav >= 2.0.0-rc.9, < 2.0.0; getgrav/grav (Packagist) = 2.0.0-rc.9, ECOSYSTEM:introduced=2.0.0-rc.9,fixed=2.0.0.
Is there a fix for CVE-2026-58657?
Yes. getgrav/grav (Packagist): upgrade to 2.0.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-58657 attacked?
It is attacked over the network.
Am I affected by CVE-2026-58657?
Check whether you run Grav or getgrav/grav (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • getgrav/grav (Packagist): upgrade to 2.0.0 or later
    composer require getgrav/grav:^2.0.0

Technical details

The vulnerability is a CSS injection flaw in the Markdown image processing pipeline. The parsedownElement() method in StaticResizeTrait directly concatenates width and height values into the styleAttributes dictionary without validating that the input is numeric or free of CSS delimiters. When a Markdown image URL contains resize=100;position:fixed;...;200, the parser extracts "100" and "200" as width/height but does not strip the intervening CSS properties. Later, parsedownElement() serializes these attributes as raw CSS declarations ($style .= $key . ': ' . $value . ';'), allowing the injected semicolons and property names to break out of the width/height context and create new CSS rules. An attacker with content-editing privileges can store this payload in a page; when viewed by a higher-privileged user, the injected CSS is rendered in their session. The attack vector is network-based (edit and view a Grav instance) and requires high privilege (editor role) and user interaction (admin/reviewer viewing the page). Prior sanitizers on direct style() and attribute() query parameters are bypassed because resize() writes directly to styleAttributes without passing through the same validation gate.

Affected products

  • Getgrav Grav 2.0.0-rc.9; 2.0 branch

Identifiers

  • CVE-2026-58657
  • GHSA-ffmg-hfvg-jhg9

Timeline

  • 2026-06-22: advisory: Advisory published to GitHub Advisory Database
  • 2026-09-16: disclosed: Vulnerability details and timeline published; CVE-2026-58657 assigned
  • 2026-09-16: patched: Patched in version 2.0.0

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.