/

CVE-2026-42611

Severity:

HIGH RISK

(8.9)

Cross-Site Scripting (XSS) in Grav Page Creation

CVE-2026-42611

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Privilege Escalation and Potential Remote Code Execution via Stored XSS

Severity:

HIGH RISK

(8.9)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Grav contains a stored cross-site scripting (XSS) vulnerability where low-privileged users who can create pages may inject malicious SVG content that executes in the browser of visiting administrators.

When a Super Admin opens a crafted page, the payload can exfiltrate sensitive system information from /admin/config/info and, when combined with admin nonces, can be leveraged toward full server compromise (remote code execution).

Affected context

This vulnerability occurs in Grav installations where:

  • Users with low privileges are allowed to create or edit pages.
  • User-supplied page content can include SVG elements or HTML-like markup.
  • Super Admins or other high-privilege users regularly view content created by lower-privileged accounts through the administrative interface or front-end.

The risk materializes when crafted SVG-based payloads are rendered in a browser context that has access to administrative routes and nonces.

Exploit preconditions

  • Attack surface: Web-based, through Grav's page creation and rendering functionality.
  • Required access: Authenticated low-privileged account capable of creating or editing pages.
  • Victim interaction: A Super Admin (or similarly privileged user) must visit or preview the malicious page in a browser.
  • Trigger point: Rendering of the malicious SVG content in the admin or front-end view, causing the browser to execute the injected script.
  • Why exploitation is possible: User-controlled page content is not sufficiently sanitized or restricted, allowing SVG constructs that can carry executable script behavior to run in the high-privilege user's browser context.

Why this happens

The root cause maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

Grav's page creation pipeline allows HTML/SVG elements within user-managed content but does not robustly neutralize or filter SVG-based vectors that can execute script-like behavior.

As a result, untrusted content is rendered directly into pages viewed by high-privilege users, causing the browser to interpret attacker-controlled data as active content within an authenticated admin session.

Potential impact

  • Theft of sensitive configuration and system information (e.g., data from /admin/config/info).
  • Impersonation of Super Admins via session hijacking or action forgery.
  • Abuse of admin nonces to perform privileged actions on behalf of the victim.
  • Potential full server compromise (RCE) when XSS is chained with administrative functionality.
  • Manipulation of site content, configuration, or user accounts.

General mitigation guidance

Effective mitigation focuses on breaking the trust boundary between user-generated content and the admin's browser:

  • Apply strict HTML and SVG sanitization to all user-supplied content, removing any attributes or elements capable of script execution or event handling.
  • Consider disallowing SVG or other active content types in user-editable fields unless they pass through a robust sanitizer.
  • Enforce a clear separation between content and control: avoid rendering untrusted content inside administrative control pages or consoles.
  • Adopt a defense-in-depth browser-side security posture, including a restrictive Content Security Policy (CSP) to reduce the impact of any residual XSS.
  • Design administrative actions and nonces so that they cannot be triggered solely via browser-executed scripts originating from user content.

How teams detect issues like this

Potential detection approaches include:

  • Static or dynamic analysis of template and content rendering logic to identify paths where user-supplied HTML/SVG is injected without sanitization.
  • Code review checklists that explicitly cover SVG handling, HTML sanitization routines, and the boundaries between user content and admin views.
  • Integration of automated security scanners or linters that flag unsafe use of raw HTML rendering APIs and absence of sanitization on rich-text inputs.
  • Application-level monitoring and logging for unusual admin-side requests that originate from viewing user content (e.g., unexpected calls to /admin/config/info triggered by page views).

Sources

SourceLink
github.comgithub.com/getgrav/grav/commit/5a12f9be8314682c8713e569e330f11805d0a663
github.comgithub.com/getgrav/grav/security/advisories/GHSA-w8cg-7jcj-4vv2

Frequently asked

questions

Yes. A remote attacker with a valid low-privileged account can upload malicious content. Exploitation completes when a Super Admin visits the crafted page, at which point the attacker-controlled script runs in the admin's browser.

No. The attacker only needs the ability to create or edit pages as a low-privileged user. The elevation to Super Admin impact occurs because the payload executes in the context of a visiting high-privilege account.

The most robust fix is to treat all user-generated content as untrusted, subject it to strong HTML/SVG sanitization, and avoid rendering raw markup directly in administrative contexts. Removing script-capable constructs from SVG and enforcing strict output encoding significantly reduces risk.

Adopt a default-deny model for active content in user inputs, implement centralized sanitization and encoding APIs, enforce security reviews around any new rendering paths, and consider adding a restrictive CSP and automated tests that validate XSS protections across content types.

Find out what's already
exploitable in your codebase.