CVE-2026-86197: Grav cross-site scripting in Twig sandbox asset methods

CVE-2026-86197 · Severity: medium · CVSS 4 · Published 2026-09-05

Grav is a flat-file content management system used to publish websites. A vulnerability in versions before 2.0.20 allows page editors to inject malicious scripts that execute for all site visitors, including administrators. Attackers can exploit this to steal administrator credentials and gain full control of the website.

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

Quick answers

Is CVE-2026-86197 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-86197 being exploited in the wild.
How severe is CVE-2026-86197?
Medium severity, with a CVSS score of 4, published 5 September 2026.
Which products and versions are affected?
getgrav/grav (Packagist) ECOSYSTEM:introduced=0,fixed=2.0.20.
Is there a fix for CVE-2026-86197?
Yes. getgrav/grav (Packagist): upgrade to 2.0.20 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-86197 attacked?
It is attacked over the network, in a web application.
Am I affected by CVE-2026-86197?
Check whether you run 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.20 or later
    composer require getgrav/grav:^2.0.20

Technical details

Grav 2.0's Twig content sandbox allowlists the addJs and addCss methods on Grav\Common\Assets without proper output escaping. A page editor with minimal privileges can call these methods to register arbitrary assets; the theme then emits them into the document head as <script> or <link> tags with unescaped URLs, allowing attribute breakout. The vulnerability bypasses the save-time XSS scanner because asset registration mutates a shared service and returns only a key, producing no markup for detection. Exploitation requires only page-edit rights and results in persistent script execution on the attacker's origin for all visitors, including administrators whose localStorage-stored JWT tokens can be exfiltrated for portable super-admin API access. Grav 2.0.20 removes addJs and addCss from the sandbox allowlist, and HTML-escapes asset URLs at all render sites; sites needing this functionality can re-add the methods via security.yaml configuration.

Affected products

  • Getgrav Grav before 2.0.20

Identifiers

  • CVE-2026-86197
  • GHSA-8hgv-xc77-jmcr

Timeline

  • 2026-08-21: disclosed: Security advisory published on GitHub
  • 2026-09-05: patched: Fix released in Grav 2.0.20
  • 2026-09-05: advisory: CVE-2026-86197 assigned and published to NVD

References

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