Lack of data validation - Path Traversal In wwbn/avideo
Description
AVideo has a Path Traversal in listFiles.json.php Enables Server Filesystem Enumeration
Summary
The listFiles.json.php endpoint accepts a path POST parameter and passes it directly to glob() without restricting the path to an allowed base directory. An authenticated uploader can traverse the entire server filesystem by supplying arbitrary absolute paths, enumerating .mp4 filenames and their full absolute filesystem paths wherever they exist on the server — including locations outside the web root, such as private or premium media directories.
Details
The vulnerable code is at objects/listFiles.json.php:8-45:
if (!User::canUpload() || !empty($advancedCustom->doNotShowImportMP4Button)) { return false; } $global['allowed'] = ['mp4']; // ... if (!empty($_POST['path'])) { $path = $_POST['path']; if (substr($path, -1) !== '/') {...
The $_POST['path'] value is used directly in glob() with no call to realpath() for normalization and no prefix check against a permitted base directory (e.g., $global['systemRootPath'] . 'videos/'). The response includes obj->path containing the full absolute filesystem path of each matched file.
The extension filter ({*.mp4,*.mp4,*.MP4}) limits results to .mp4 files, which prevents reading credentials or source code but does not prevent enumeration of video files stored in access-controlled locations such as:
Premium/paid content directories
Private or unlisted media stores
Backup directories containing .mp4 files
Paths revealing sensitive server directory structure
canUpload is a standard low-privilege role granted to any registered uploader; it does not imply administrative trust.
PoC
# Step 2: Enumerate MP4 files in the web root (expected behavior) curl -b "PHPSESSID=<session>" -X POST https://target.avideo.site/listFiles \ -d "path=/var/www/html/videos/" # Step 3: Traverse outside intended directory to private content store curl -b "PHPSESSID=<session>" -X POST https://target.avideo.site/listFiles \ -d "path=/var/private/premium-content/"...
Expected behavior: Only files within the designated upload directory should be listable. Actual behavior: Files from any path readable by the web server process are returned with full absolute paths.
Impact
Unauthorized media enumeration: An uploader can discover private, premium, or access-controlled .mp4 files stored outside their permitted directory.
Filesystem structure disclosure: Full absolute paths reveal server directory layout, aiding further attacks.
Content bypass: In AVideo deployments where premium video files are stored in filesystem directories not protected by application access control, this exposes the filenames and paths needed to directly access them if other path traversal or direct-file-access weaknesses are present.
Blast radius: Requires canUpload permission (low privilege), but this is the standard permission for all video uploaders on a multi-user AVideo instance.
Recommended Fix
Restrict the supplied path to an allowed base directory using realpath():
if (!empty($_POST['path'])) { $allowedBase = realpath($global['systemRootPath'] . 'videos') . '/'; $path = realpath($_POST['path']); // Reject paths that don't start with the allowed base if ($path === false || strpos($path . '/', $allowedBase) !== 0) { http_response_code(403); echo json_encode(['error' => 'Path not allowed']);...
realpath() resolves ../ sequences before the prefix check, preventing traversal bypasses.
Mitigation
Update Impact
Minimal update. May introduce new vulnerabilities or breaking changes.
Ecosystem | Component | Affected version | Patched versions |
|---|---|---|---|
packagist | 26.0 |
Aliases
References