CVE-2024-28118: Server Side Template Injection (SSTI) in getgrav/grav

getgrav/grav Updated 02 Oct 2025

Summary

22/03/2024
Yes i
High
8.8

CVE-2024-28118: Server Side Template Injection (SSTI). Affects getgrav/grav versions < 1.7.45. Fixed in 1.7.45. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

getgrav/grav is an open-source flat-file CMS written in PHP. It allows users to create and manage websites using a file-based approach instead of a traditional database. The package utilizes the Twig templating engine for rendering dynamic content. However, a vulnerability in the Twig context of getgrav/grav allows an attacker to redefine a config variable, bypassing a previous patch.

Vulnerability Detail

The vulnerability arises due to unrestricted access to the twig extension class from the grav context. This allows an attacker to redefine the config variable, which can have severe consequences. The Twig context has a function called getFunction, which, if the value of $name does not exist in $this->functions, executes callback functions stored in $this->functionCallbacks using call_user_func. By registering an arbitrary function using registerUndefinedFunctionCallback, an attacker can execute any arbitrarily registered callback function. The default function callback can be manipulated to set the value of system.twig.undefined_functions to false, enabling the execution of the attacker's registered callback function. This vulnerability can be exploited by any administrative user allowed to create or edit pages with enabled Twig processing of static pages, potentially leading to arbitrary code execution and privilege escalation.

How To Fix

Minimum fixed version

1.7.45

This is the first release that contains the fix.

composer require getgrav/grav:1.7.45

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is essential to update getgrav/grav to the latest version to fix the issue.

Conclusion

The vulnerability in getgrav/grav allows an attacker to redefine a config variable, potentially leading to arbitrary code execution and privilege escalation. It is crucial to update getgrav/grav to version 1.7.45 or later to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for getgrav/grav →

Share this vulnerability

FAQ

getgrav/grav is an open-source flat-file CMS written in PHP that allows users to create and manage websites using a file-based approach instead of a traditional database.

Server Side Template Injection (SSTI) is a vulnerability that allows an attacker to inject and execute arbitrary code in server-side templates, leading to potential code execution and privilege escalation.

The vulnerability in getgrav/grav allows an attacker to redefine a config variable, potentially leading to arbitrary code execution and privilege escalation. This can be exploited by any administrative user allowed to create or edit pages with enabled Twig processing of static pages.

Yes, a fix is available for this vulnerability. It is recommended to update getgrav/grav to version 1.7.45 or later to mitigate the issue.

No, there are no known workarounds for this vulnerability. Updating getgrav/grav to the latest version is the recommended solution.

Related vulnerabilities

Recent vulnerabilities recorded for getgrav/grav.

How To Fix

Minimum fixed version

1.7.45

This is the first release that contains the fix.

composer require getgrav/grav:1.7.45

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback