Sep 18, 2026·7 min read·26 visits
An authenticated path traversal vulnerability in Grav CMS before 2.0.16 allows media administrators to delete arbitrary files on the system by bypassing incomplete directory validation checks in the MediaUploadTrait.
A path traversal vulnerability exists in Grav CMS versions prior to 2.0.16. The flaw occurs within the file validation mechanisms of the MediaUploadTrait, enabling authenticated users with media management privileges to bypass sandbox limitations. This allows the deletion of arbitrary files on the filesystem, which can result in denial of service or remote code execution.
Grav CMS is a flat-file content management system that relies on structured filesystem directories rather than database backends. In versions prior to 2.0.16, the system handles media-related transactions via functions defined in the MediaUploadTrait class. These operations are exposed through the administrative panel and through custom third-party plugins implementing the MediaUploadInterface structure.
The core vulnerability is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). The validation routines fail to neutralize directory traversal sequences in user-controlled file deletion parameters. An attacker can manipulate input values to escape the root directory configured for media files, allowing operations to interact with other filesystem areas.
Because the administrative control panel allows authenticated users to upload and manage media files, this vulnerability is accessible to users with media management privileges. Although upstream controllers sometimes sanitize file parameters, direct trait calls inside custom extensions and default administrative deletion actions lack validation containment.
This flaw allows authenticated users with media management permissions to delete system configuration files, environmental variables, or security policy definitions. Removing critical system configuration files like security.yaml or .htaccess can alter application security postures, leading to application denial of service or opening paths to execute arbitrary code.
The technical root cause of CVE-2026-72695 resides in system/src/Grav/Common/Media/Traits/MediaUploadTrait.php inside the deleteFile() method. This method accepts a user-controlled $filename string and attempts to validate it before initiating the filesystem deletion sequence.
To perform validation, the system utilizes the static method Utils::checkFilename() against the isolated filename. However, before the check is executed, the code uses a filesystem utility to extract the base name of the path:
$basename = $filesystem->basename($filename);
if (!Utils::checkFilename($basename)) {
throw new RuntimeException(...);
}If an attacker inputs a traversal string such as ../../../../config/security.yaml, the filesystem helper extracts only the last segment of the path, which is security.yaml. Because security.yaml contains no restricted directory traversal sequences or invalid characters, Utils::checkFilename() validates the string and returns true.
The critical error is that the original, unvalidated $filename variable containing the directory traversal sequence is preserved and used in the actual file system call. This path parameter is forwarded downstream to doRemove($filename, $path), where it is concatenated directly with the target media root path and processed using PHP's native unlink() function. The operating system resolves the traversal indicators, allowing the deletion of files outside of the media root.
The vulnerable code implementation of the deleteFile method processed user input with insufficient checks before performing file operations. Below is the vulnerable segment of code:
// Vulnerable implementation in MediaUploadTrait.php
public function deleteFile(string $filename, ?array $settings = null): void
{
$settings = $this->getUploadSettings($settings);
$filesystem = Filesystem::getInstance(false);
// The application extracts only the basename for validation
$basename = $filesystem->basename($filename);
if (!Utils::checkFilename($basename)) {
throw new RuntimeException($this->translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . $filename, 400);
}
$path = $settings['destination'] ?? $this->getPath();
// The original unsanitized $filename is passed directly to the deletion handler
$this->doRemove($filename, $path);
}To mitigate this issue, the patch introduced the checkFilepath() helper function. This function analyzes the full directory path to ensure that traversal operations are identified and rejected:
// Patched helper function in MediaUploadTrait.php
protected function checkFilepath(string $filename): bool
{
return $filename !== ''
&& strpbrk($filename, "\\\0") === false
&& !str_starts_with($filename, '/')
&& !in_array('..', explode('/', $filename), true);
}The helper performs four sequential validation operations on the input string:
strpbrk to block backslash characters and null byte injection attempts....The deleteFile() method was updated to implement this validation step, checking the integrity of both the path structure and the basename:
// Patched implementation in deleteFile()
$basename = $filesystem->basename($filename);
if (!$this->checkFilepath($filename) || !Utils::checkFilename($basename)) {
throw new RuntimeException($this->translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . $filename, 400);
}This implementation closes the validation gap. It ensures that any input containing traversal components is blocked before reaching the deletion mechanism. Similar checks were also applied to file upload and renaming pathways in the trait.
Exploitation of CVE-2026-72695 requires an authenticated user session with media management permissions. The attack cannot be carried out by unauthenticated users under default configurations. This limitation narrows the attack surface to malicious insiders or attackers who have compromised lower-privileged administrative accounts.
The attack begins when the threat actor identifies a media deletion API endpoint. Instead of providing a standard filename inside the target media folder, the attacker crafts an HTTP request containing relative path indicators. The payload targeting a configuration file looks like this:
POST /admin/media/delete HTTP/1.1
Host: target-grav-site.local
Content-Type: application/json
Authorization: Bearer <valid_token>
{
"filename": "../../../../user/config/security.yaml"
}When the backend processes this request, the vulnerable deleteFile method parses the payload. The extraction component isolates security.yaml and verifies its validity. The method then executes the file removal, causing PHP to resolve the relative traversal indicators relative to the media folder. This resolves to the absolute system path /var/www/html/user/config/security.yaml and deletes the file.
The physical delete operation succeeds because the web server daemon has write permissions on the flat-file configuration directories. The system configuration is deleted, leaving the application in an unconfigured state or disabling specific security controls.
The primary impact of this vulnerability is arbitrary file deletion on the target filesystem. Because Grav CMS uses configuration files to define permissions, routing, and access controls, the deletion of key configuration components can severely disrupt system operations.
Deleting files such as user/config/security.yaml removes defined security policies, which can result in privilege escalation or the bypass of administrative restrictions. If an attacker deletes access control configurations like .htaccess, the web server may expose internal directories or execute files that were previously restricted. This exposure can be leveraged to achieve remote code execution.
According to the Common Vulnerability Scoring System (CVSS v3.1), the vulnerability has a base score of 8.1. The vector string is CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H. This reflects high impacts on both integrity and availability, balanced by the requirement for authenticated low-privilege access.
The Exploit Prediction Scoring System (EPSS) score is 0.00567, indicating a relatively low near-term likelihood of active exploitation in the wild. This is due to the authentication requirement and the absence of publicly released weaponized exploitation frameworks.
The primary mitigation for this vulnerability is upgrading Grav CMS to version 2.0.16 or newer. The update incorporates the checkFilepath() validation helper across all media manipulation interfaces within MediaUploadTrait to prevent path traversal.
Administrators who cannot apply updates immediately should implement system-level mitigations. Directory and file permissions must be audited to ensure that the web server user does not have write access to critical configuration directories. This prevents the deletion of configuration files even if a path traversal bypass is attempted.
Web Application Firewall (WAF) rule sets can be deployed to monitor inbound traffic for traversal sequences. Filtering parameters for structures containing ../ or encoded variations like ..%2f directed toward media management paths can help block exploitation attempts.
Software developers working with similar systems should ensure that input validation is applied to full logical paths rather than isolated file components. Relying on basename extraction for validation is an insufficient control when the original, unsanitized input is passed to filesystem interfaces.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
Grav CMS getgrav | < 2.0.16 | 2.0.16 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22: Improper Limitation of a Pathname to a Restricted Directory |
| Attack Vector | Network (Unauthenticated: No, Requires authenticated media management privileges) |
| CVSS v3.1 Score | 8.1 (High) |
| EPSS Score | 0.00567 (Percentile: 45.53%) |
| Impact | Arbitrary File Deletion / Denial of Service / Remote Code Execution |
| Exploit Status | Proof-of-Concept (PoC) |
| KEV Status | Not Listed in CISA KEV Catalog |
The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as '..' that can resolve to a location outside of the directory.
CVE-2026-126303 (GHSA-8fx7-8jr8-84rv) is an uncontrolled resource consumption vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. The flaw is located in the SteppingRecursiveDescentParser.parse() method within the nltk.parse.recursivedescent module. Because the parser executes a top-down recursive descent stepping loop without enforcing an execution time deadline or step limit, processing tokens against a left-recursive, self-embedding, or ambiguous Context-Free Grammar (CFG) causes the parser to enter an infinite loop. This results in complete CPU core exhaustion and worker thread starvation, leading to an application-level denial of service.
File Browser versions prior to 2.63.17 contain an authorization and state-management flaw in the BoltDB storage backend. When an authenticated user deletes a shared directory via an HTTP request with a trailing slash (e.g., DELETE /api/resources/a/), the share cleanup routine queries the database index using the unnormalized path before stripping the trailing slash. Because canonical share paths are stored without trailing slashes (e.g., /a), the database prefix query fails to match the parent directory share record. If a directory with the same name is later recreated, the dormant public share hash automatically reactivates and exposes the new directory contents to unauthenticated users.
An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.