CVE-2023-34253

8.8 HIGH

📋 TL;DR

This vulnerability allows attackers with login access to Grav's Admin panel and page creation/update permissions to inject malicious templates and achieve remote code execution. The insufficient denylist in Grav's template system can be bypassed using unsafe functions not banned, capitalized callable names, or fully-qualified names. All Grav installations prior to version 1.7.42 with the Admin plugin enabled are affected.

💻 Affected Systems

Products:
  • Grav CMS
Versions: All versions prior to 1.7.42
Operating Systems: All platforms running Grav
Default Config Vulnerable: ⚠️ Yes
Notes: Requires Grav Admin plugin enabled and attacker must have login access with page creation/update permissions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with remote code execution, allowing attackers to execute arbitrary commands, access sensitive data, install malware, or pivot to other systems.

🟠

Likely Case

Attackers with valid admin credentials achieve remote code execution, potentially leading to data theft, website defacement, or deployment of backdoors.

🟢

If Mitigated

Limited impact if proper access controls restrict admin panel access and template editing permissions to trusted users only.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires authenticated access but is straightforward once credentials are obtained. Multiple bypass methods exist.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.7.42

Vendor Advisory: https://github.com/getgrav/grav/security/advisories/GHSA-j3v8-v77f-fvgm

Restart Required: No

Instructions:

1. Backup your Grav installation. 2. Update Grav to version 1.7.42 or later via the built-in GPM (Grav Package Manager) or manually. 3. Clear the cache: `bin/grav clear-cache`. 4. Verify the update completed successfully.

🔧 Temporary Workarounds

Restrict Admin Panel Access

all

Limit access to the Grav Admin panel to trusted IP addresses only using web server configuration or firewall rules.

Disable Template Editing

all

Remove page creation/update permissions from non-essential admin users to prevent template injection.

🧯 If You Can't Patch

  • Implement strict access controls to the Grav Admin panel, allowing only trusted administrators.
  • Monitor for suspicious template modifications and admin panel login attempts from unusual locations.

🔍 How to Verify

Check if Vulnerable:

Check your Grav version by running `bin/grav version` or viewing the Admin panel dashboard. If version is below 1.7.42, you are vulnerable.

Check Version:

bin/grav version

Verify Fix Applied:

After updating, confirm version is 1.7.42 or higher using `bin/grav version`. Test that template injection attempts are blocked.

📡 Detection & Monitoring

Log Indicators:

  • Unusual template file modifications
  • Suspicious PHP function calls in logs
  • Multiple failed login attempts followed by successful admin login

Network Indicators:

  • Unexpected outbound connections from Grav server
  • Unusual traffic patterns to admin panel

SIEM Query:

source="grav_logs" AND ("template injection" OR "eval(" OR "system(" OR "exec(")

🔗 References

📤 Share & Export