CVE-2026-62672

Grav: Authenticated ReDoS via regex_replace in Twig Sandbox

Published Aug 19, 2026 CVSS 4.0 · 6 Medium EPSS < 1% KEV · Not listed
Description
Grav is a file-based Web platform. Prior to 2.0.4, Grav allowlists the regex_replace filter and function in system/config/security.yaml, and GravExtension::regexReplace() passes an editor-controlled pattern directly to preg_replace(). When security.twig_content.process_enabled is enabled, an authenticated page editor can publish a catastrophically backtracking pattern that consumes PHP worker CPU and denies service to site visitors. This issue is fixed in version 2.0.4.

Analysis

AI-generated

Technical impact

Grav injects a user-controlled regular expression pattern into PHP’s preg_replace() function without further sanitization. The regex_replace filter and function are allowed in the system/config/security.yaml file, and the GravExtension::regexReplace() method passes the pattern directly to the regex engine. A malicious editor can craft a catastrophically backtracking pattern that consumes near‑total CPU resources, causing the PHP worker to stall and denying service to all site visitors. The weakness is a regex denial‑of‑service flaw classified as CWE‑1333.

Affected Systems

The issue affects all Grav releases prior to version 2.0.4, whenever the security.twig_content.process_enabled flag is true and the regex_replace filter is in the sandbox allowlist. Users who run a vulnerable Grav installation with administrative or page‑editor permissions must upgrade the core to 2.0.4 or later, or otherwise remove or restrict the regex_replace functionality in system/config/security.yaml.

Risk and Exploitability

The CVSS score of 6.0 indicates moderate severity. The EPSS score is < 1%, indicating a very low likelihood of exploitation, and the vulnerability is not listed in CISA’s KEV catalog. Exploitation requires an authenticated editor who can publish a Twig template. The attack vector is internal and privileged; the potential impact is full denial of service to all site visitors when the malformed pattern is processed.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply the official Grav 2.0.4 patch or later version to eliminate the vulnerable regex_replace implementation.
  • Remove or comment out the regex_replace entry from the system/config/security.yaml allowlist to prevent the filter from executing.
  • Set the security.twig_content.process_enabled flag to false if template processing is not required to avoid execution of potentially dangerous Twig templates.

Generated by OpenCVE AI on August 20, 2026 at 15:10 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-37f3-6p89-6qr9 Grav: Authenticated ReDoS via regex_replace in Twig Sandbox
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Getgrav
Getgrav grav
Vendors & Products Getgrav
Getgrav grav
Type Values Removed Values Added
Description Grav is a file-based Web platform. Prior to 2.0.4, Grav allowlists the regex_replace filter and function in system/config/security.yaml, and GravExtension::regexReplace() passes an editor-controlled pattern directly to preg_replace(). When security.twig_content.process_enabled is enabled, an authenticated page editor can publish a catastrophically backtracking pattern that consumes PHP worker CPU and denies service to site visitors. This issue is fixed in version 2.0.4.
Title Grav: Authenticated ReDoS via regex_replace in Twig Sandbox
Weaknesses CWE-1333
References
Metrics cvssV4_0

{'score': 6, 'vector': 'CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-1333

    Inefficient Regular Expression Complexity

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Aug 19, 2026, 6:00 PM
Reserved
Jul 14, 2026, 8:22 PM
Status
Deferred
Published
Aug 19, 2026, 4:18 PM
Modified
Sep 9, 2026, 9:13 PM