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以降にアップデートする。
情報なし
該当バージョンを使用している場合は影響を受ける可能性がある。
影響パッケージ
参照URL
- web github.com
- web disclosure@vulncheck.com
- web nvd.nist.gov
- web github.com
- web github.com