How to Exploit SSTI in Grav CMS | CVE-2024-28116

CVE-2024-28116

Grav CMS, an open-source, flat-file content management system, had a security vulnerability before version 1.7.45. This vulnerability was a Server-Side Template Injection (SSTI) that allowed authenticated users with editor permissions to execute arbitrary code on the remote server, bypassing the security sandbox. Version 1.7.45 includes a patch that addresses this security issue.

Disclaimer

The content provided here is for educational purposes only. It is designed to help security enthusiasts and professionals understand vulnerabilities and improve application security. Please use the information responsibly and never for illegal activities or unauthorized testing. Always ensure you have proper authorization before performing any security testing on systems, applications, or networks.

We are not responsible for any misuse of the materials shared here or any consequences that arise from their use. All testing should be done in a controlled environment, such as the labs or Docker images we provide, or with explicit permission from system owners. By using OpenExploit resources, you agree to follow applicable laws and ethical guidelines.

About Grav CMS

Grav CMS is a modern, open-source flat-file content management system that prioritizes speed, simplicity, and flexibility. Built with PHP, it requires no database and is designed to be easy to set up and maintain. Grav CMS has a powerful API and an extensive library of themes and plugins, making it highly customizable and extensible. With its intuitive admin interface and markdown-based content creation, Grav CMS is ideal for developers and content creators seeking a lightweight solution for building and managing websites.

Mitigation

  1. Identify whether your Grav CMS version is prior to 1.7.45.
  2. If your Grav CMS is an affected version, upgrade to version 1.7.45 immediately.
  3. After upgrading, verify that the patch has been applied successfully and that the SSTI vulnerability is resolved.
  4. Review user roles and permissions to ensure that only trusted users have editor permissions.
  5. Regularly monitor and update Grav CMS to ensure all security patches are applied in a timely manner.

Exploit Scenario

An exploit scenario for the vulnerability in Grav CMS prior to version 1.7.45 would involve an attacker gaining access to the system with editor-level permissions or higher. Once authenticated, the attacker could exploit the Server-Side Template Injection (SSTI) vulnerability to inject malicious code into the server-side templates. This could allow the attacker to execute arbitrary code on the remote server, effectively bypassing the existing security sandbox designed to prevent such actions. The attacker could then potentially gain unauthorized access to sensitive data, modify content, or take control of the server. To mitigate this issue, it is recommended to update Grav CMS to version 1.7.45 or later, which contains a patch for the vulnerability.

DockerHub Link

To try out a demo environment for CVE-2024-28116, you can visit our DockerHub repository here

Video Tutorial

Video tutorials for exploiting CVE-2024-28116 is available here

About OpenExploit

OpenExploit is a learning platform dedicated to exploring and understanding vulnerabilities in open-source and widely used applications. We focus on manual exploitation techniques, enabling security enthusiasts to learn and build their skills without over-reliance on automation scripts.

Read more