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()のパストラバーサルの脆弱性があります。メディア管理権限を持つ認証ユーザーが、ディレクトリトラバーサルシーケンスを含むファイル名を指定することにより、任意のファイルを削除できる可能性があります。
GravのMediaUploadTrait::deleteFile()にパストラバーサルの脆弱性が存在。
Grav 2.0.16未満で、MediaUploadTrait::deleteFile()に影響。
媒体管理権限を持つ認証ユーザーが任意のファイルを削除できる重大な問題。
Gravをバージョン2.0.16以降にアップデートする。
情報なし
該当バージョンを使用している場合は影響を受ける可能性がある。
Affected packages
References
- web github.com
- web disclosure@vulncheck.com
- web nvd.nist.gov
- web github.com
- web github.com