English version →
Webアプリケーション
CVE-2026-72695 high CVSS 8.1

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

概要

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

原文の説明

取得元が公開している説明をそのまま載せています (多くは英語)。

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…

出典: NIST National Vulnerability Database NVD GitHub Advisory

AI要約

外部の AI が作成した要約です。誤りを含むことがあります。重要な判断の前に、下の原文と参照URLを確認してください。

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

❓ 何が問題か

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

📍 影響範囲

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

🔥 重要度

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

🔧 修正方法

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

🛡️ 暫定回避

情報なし

🔍 検知方法

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

影響パッケージ

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

参照URL

当サイトでは、アクセス解析と広告の効果測定のために Cookie を使います。株式会社Game のサイト共通の設定です。 詳しく