The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-42841

CVE-2026-42841: Getgrav Grav XSS Vulnerability

CVE-2026-42841 is a cross-site scripting flaw in Getgrav Grav that allows authenticated editors to inject JavaScript through image attributes. This article covers the technical details, affected versions, and patches.

Published: May 18, 2026

CVE-2026-42841 Overview

CVE-2026-42841 is a stored cross-site scripting (XSS) vulnerability in Grav, a file-based Web platform developed by Getgrav. The flaw affects all versions prior to 2.0.0-beta.2. An authenticated user with page editing permissions can inject executable JavaScript event-handler attributes into rendered image HTML through Grav's Markdown media action syntax. The root cause lies in Markdown image query parameters being converted into callable media actions, which expose the public attribute() media method. This method accepts an arbitrary HTML attribute name and value applied directly to the generated <img> element. The issue is tracked under CWE-79 and fixed in Grav 2.0.0-beta.2.

Critical Impact

An authenticated editor can inject arbitrary event handlers (e.g., onerror, onload) onto rendered images, leading to JavaScript execution in the context of any visitor or administrator viewing the affected page.

Affected Products

  • Getgrav Grav versions prior to 2.0.0-beta.2
  • Getgrav Grav 2.0.0-beta1
  • Fixed in Getgrav Grav 2.0.0-beta.2

Discovery Timeline

  • 2026-05-11 - CVE-2026-42841 published to NVD
  • 2026-05-12 - Last updated in NVD database

Technical Details for CVE-2026-42841

Vulnerability Analysis

Grav's Markdown processor translates query parameters appended to image references into method calls on the corresponding media object. When an editor writes Markdown such as ![alt](image.jpg?attribute=name,value), the parser invokes the attribute() method on the media object. This method is public and writes any supplied key/value pair directly into the HTML attribute set of the rendered image element. Because no allowlist or sanitization was applied to the attribute name, an editor could set names such as onerror, onload, or onclick along with arbitrary JavaScript payloads as the value. The script then executes whenever the page is rendered in a browser.

Root Cause

The attribute() method in system/src/Grav/Common/Media/Traits/MediaObjectTrait.php accepted any non-empty string as an attribute name without validating it against a safe character set or rejecting event-handler attributes. The Markdown media action dispatcher reached this method directly from editor-controlled input, exposing an XSS sink reachable through standard image syntax.

Attack Vector

Exploitation requires an authenticated account with page editing privileges and user interaction by a victim who views the rendered page. The attacker crafts a Markdown image whose query string sets a JavaScript event-handler attribute and value. When Grav renders the page, the resulting <img> element fires the handler in the victim's browser, executing script in the site's origin. This permits session theft, admin action forgery, and content tampering against any user who loads the page.

php
    /**
     * Add custom attribute to medium.
     *
     * Reachable from Markdown via `?attribute=name,value` on image excerpts, so
     * the attribute NAME is editor-controlled. We restrict it to plain HTML
     * attribute identifiers (alphanumerics + `-`/`:`/`_`) and reject any name
     * that would inject script when rendered onto an `<img>` tag — event
     * handlers (`on*`), inline style, the XML namespace, srcdoc, and the
     * various `form*` attributes whose URL targets are themselves trusted as
     * actions. GHSA-r7fx-8g49-7hhr.
     *
     * @param string $attribute
     * @param string $value
     * @return $this
     */
    public function attribute($attribute = null, $value = '')
    {
        if (empty($attribute) || !is_string($attribute)) {
            return $this;
        }
        if (!self::isSafeAttributeName($attribute)) {
            return $this;
        }
        $this->attributes[$attribute] = $value;
        return $this;
    }

Source: Grav security patch commit 5a12f9b. The patch enforces an allowlist of safe attribute name characters and explicitly rejects event handlers, inline style, XML namespace declarations, srcdoc, and form* attributes.

Detection Methods for CVE-2026-42841

Indicators of Compromise

  • Rendered HTML containing <img> tags with event-handler attributes such as onerror, onload, or onclick in pages stored under the Grav content directory.
  • Markdown source files containing image syntax with ?attribute=on patterns or other suspicious query parameters targeting the attribute media action.
  • Unexpected outbound requests from administrator browsers shortly after viewing user-authored pages.

Detection Strategies

  • Scan the Grav user/pages directory for Markdown files containing image references with query strings that match attribute=on[a-z]+, or other event-handler patterns.
  • Inspect rendered page output for <img> elements carrying event-handler attributes that did not originate from official themes or plugins.
  • Review Grav admin audit logs for editor accounts that created or modified pages immediately before XSS indicators appeared.

Monitoring Recommendations

  • Enable a strict Content Security Policy (CSP) that blocks inline event handlers and report violations to a monitoring endpoint.
  • Forward web server access logs and Grav admin logs to a centralized log platform for correlation of editor activity with anomalous client-side behavior.
  • Alert on creation of new editor-role accounts or privilege changes that grant page editing permissions.

How to Mitigate CVE-2026-42841

Immediate Actions Required

  • Upgrade Grav to version 2.0.0-beta.2 or later, which contains the fix in MediaObjectTrait::attribute().
  • Audit all editor and administrator accounts and revoke page editing permissions for accounts that are not strictly required.
  • Review existing pages for malicious Markdown image syntax and remove any unauthorized attribute injections.

Patch Information

The fix is delivered in Grav 2.0.0-beta.2. The patch in commit 5a12f9b introduces an isSafeAttributeName() validator that restricts attribute names to alphanumerics plus -, :, and _, and rejects event handlers, style, srcdoc, XML namespace attributes, and form* attributes. Refer to the GitHub Security Advisory GHSA-r7fx-8g49-7hhr and the upstream commit.

Workarounds

  • Restrict the editor role to highly trusted users until the patched version is deployed, since exploitation requires page editing permissions.
  • Deploy a Content Security Policy that disallows inline event handlers (script-src without unsafe-inline) to neutralize injected on* attributes.
  • Use a web application firewall rule to block requests containing Markdown image references with attribute=on query parameters.
bash
# Upgrade Grav using the bundled CLI updater
bin/gpm selfupgrade -f

# Verify installed version is 2.0.0-beta.2 or later
bin/grav --version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechGrav

  • SeverityMEDIUM

  • CVSS Score6.9

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:P/VC:H/VI:L/VA:N/SC:H/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-79
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-42842: Grav CMS Form Plugin XSS Vulnerability

  • CVE-2026-44737: Grav Admin Plugin XSS Vulnerability

  • CVE-2025-66309: Grav-plugin-admin XSS Vulnerability

  • CVE-2025-66310: Grav Admin Plugin Stored XSS Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English