Skip to content
RCE Write-up Advanced

Grav-ity of the Situation: RCE in Grav CMS

Grav CMS had a password reset poisoning vulnerability via Host header injection, allowing an attacker to steal reset tokens and take over accounts. Combined with a file upload path traversal, an attacker could overwrite files like composer.json to achieve remote code execution.

Riyush Ghimire Follow

Published on tantosec.com

In this blog post, critical security vulnerabilities discovered in Grav CMS ↗ (opens in a new tab) are explored. Two out of four issues I reported have been assigned CVE-2024-27921 ↗ (opens in a new tab) and CVE-2024-34082 ↗ (opens in a new tab).

Riyush Ghimire, on tantosec.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the password reset link was built using the untrusted Host header without proper validation, and the file upload function used a flawed path traversal check that allowed writing files outside the intended directory.

What the attacker needed

Victim clicks a link or automated scanner visits; low-privileged account with file upload; Grav with Admin plugin

The fix

The password reset poisoning was partially addressed by adding an optional site_host configuration, but the report notes the vulnerability persists if not set; the file upload path traversal was fixed in CVE-2024-27921.

How it was found

  1. Navigate to /admin/forgot and request a password reset for a valid username.
  2. Intercept the request and modify the Host header to an attacker-controlled domain.
  3. The victim receives a password reset email with a link pointing to the attacker's domain.
  4. The attacker steals the reset token from the victim's click and resets the password.
  5. Log in as a low-privileged user with file upload permissions.
  6. Upload a file with a path traversal filename to overwrite a sensitive file like composer.json.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This report describes two bugs in a website building tool called Grav. The first lets an attacker trick a password reset email into containing a link to the attacker's own website, so when the victim clicks it, the attacker can steal the reset code and take over the account. The second lets someone with limited access upload files to unintended folders, which can be abused to run commands on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Riyush Ghimire

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.