Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. getgrav/grav
  4. ›
  5. GHSA-8hgv-xc77-jmcr

GHSA-8hgv-xc77-jmcr: Grav: Page editors can inject arbitrary script into rendered pages via the Twig sandbox's assets.addJs/addCss allowlist, escalating to super-admin

August 21, 2026

Grav 2.0 renders editor-authored Twig in page content by default and relies on the Twig content sandbox to contain it. The shipped sandbox policy allowlists addcss and addjs on Grav\Common\Assets (system/src/Grav/Common/Twig/Sandbox/SandboxDefaults.php:307). Because the sandbox arbitrates the call and not its downstream effect, a user holding only page-edit rights can register an arbitrary asset from page content; the theme then emits it into the document head as a <script src> / <link href> tag. The asset URL is concatenated into that tag without escaping, so it can also break out of its own attribute.

The save-time XSS scan cannot see this: Security::detectXssInEditorContent() renders the content body in isolation and inspects the returned string, while assets.addJs() acts by mutating the shared Assets service and returns only an object key. The payload contains no markup for the scanner to flag.

This is not a Security::detectXss() bypass. It is content reaching an unescaped output sink through an allowlisted method.

References

  • github.com/advisories/GHSA-8hgv-xc77-jmcr
  • github.com/getgrav/grav/commit/a4e8c4b748eb338ee7ab1dd26e7620a93bade047
  • github.com/getgrav/grav/releases/tag/2.0.20
  • github.com/getgrav/grav/security/advisories/GHSA-8hgv-xc77-jmcr

Code Behaviors & Features

Detect and mitigate GHSA-8hgv-xc77-jmcr with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.0.20

Fixed versions

  • 2.0.20

Solution

Upgrade to version 2.0.20 or above.

Impact 5.4 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Source file

packagist/getgrav/grav/GHSA-8hgv-xc77-jmcr.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Fri, 11 Sep 2026 00:17:11 +0000.