Web Application
CVE-2026-72695 high CVSS 8.1

Path Traversal in getgrav/grav (CVE-2026-72695)

Summary

Path traversal in getgrav/grav (CVE-2026-72695). Data can be tampered with by attackers. Exploitable via POST /admin/pages/mypage/task. Mitigation: upgrade to 2.0.16 or later.

Original description

The description as published by the source.

Path Traversal in MediaUploadTrait::deleteFile() Allows Arbitrary File Deletion

Summary

A path traversal vulnerability in MediaUploadTrait::deleteFile() allows an authenticated user with media management permissions to delete arbitrary files on the server. The method validates only the basename portion of the filename using Utils::checkFilename(), while the directory path (which may contain ../ sequences) is preserved and passed unvalidated to unlink(). This enables directory escape from the intended media storage path.

Severity

High (8.1) - CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H

CWE

CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Details

In system/src/Grav/Common/Media/Traits/MediaUploadTrait.php, the deleteFile() method (lines 332-365) performs filename validation only on the basename, not the full path:

public function deleteFile(string $filename, ?array $settings = null): void
{
    $settings = $this->getUploadSettings($settings);
    $filesystem = Filesystem::getInstance(false);

    // Line 339-340: Only the BASENAME is validated
    $basename = $filesystem->basename($filename);  // e.g. "evil.jpg" from "../../evil.jpg"
    if (!Utils::checkFilename($basename)) {         // passes - no traversal in basename
        throw new RuntimeException(/* ... */);
    }

    $path = $settings['destination'] ?? $this->getPath();
    // ...

    // Line 353: Full pathname (with traversal) is p…

Source: NIST National Vulnerability Database NVD GitHub Advisory

AI summary

Written by an external AI model and may contain mistakes. Check the original description and references below before acting on it.

Grav 2.0.16未満のバージョンには、MediaUploadTrait::deleteFile()のパストラバーサルの脆弱性があります。メディア管理権限を持つ認証ユーザーが、ディレクトリトラバーサルシーケンスを含むファイル名を指定することにより、任意のファイルを削除できる可能性があります。

❓ What is the problem

GravのMediaUploadTrait::deleteFile()にパストラバーサルの脆弱性が存在。

📍 Affected scope

Grav 2.0.16未満で、MediaUploadTrait::deleteFile()に影響。

🔥 Severity

媒体管理権限を持つ認証ユーザーが任意のファイルを削除できる重大な問題。

🔧 How to fix

Gravをバージョン2.0.16以降にアップデートする。

🛡️ Workaround

情報なし

🔍 Detection

該当バージョンを使用している場合は影響を受ける可能性がある。

Affected packages

composer getgrav/grav
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.0.16"}]}]

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details