Summary
WWBN AVideo up to version 26.0 contains an unrestricted file upload flaw in the downloadVideoFromDownloadURL() function that allows remote content to be stored under the web root with attacker-controlled filenames and extensions, including .php.
By abusing error handling around the resolution parameter, an attacker can cause uploaded temporary files to remain in a web-accessible cache directory, potentially enabling remote code execution through direct HTTP requests to the dropped PHP file.
Affected context
This vulnerability arises in WWBN AVideo deployments that:
- Expose the
aVideoEncoder.json.phpendpoint and allow users to request downloads from remote URLs - Store downloaded content in
videos/cache/tmpFile/or a similar web-accessible directory - Use the original remote filename and extension (including
.php) when saving temporary files - Invoke
forbiddenPage()and terminate execution early when encountering an invalid or unexpectedresolutionparameter
The issue manifests when the temporary file is created before validation and cleanup, but not subsequently removed or moved due to premature termination.
Exploit preconditions
- Attack surface: HTTP(S) endpoint
objects/aVideoEncoder.json.phpreachable from the attacker's environment. - Required access: Ability to send crafted requests to the encoder API with attacker-controlled
downloadURLandresolutionparameters (typically unauthenticated or low-privileged web access, depending on deployment). - Trigger point:
- The attacker supplies a
downloadURLpointing to content they control, using a filename ending in.phpor another executable extension recognized by the web server. - The attacker provides an invalid
resolutionvalue that causesforbiddenPage()to be invoked. - The function creates a temporary file in
videos/cache/tmpFile/and then dies before moving or deleting it. - Why exploitation is possible:
- Downloaded content is saved using the original filename and extension directly under a web-served directory without enforcing safe extensions or performing robust validation before making it reachable.
- The error path short-circuits cleanup logic, leaving the temporary file persistently accessible to subsequent HTTP requests.
Why this happens
The core bug is an unrestricted file upload pattern where remote content is fetched and stored using attacker-controlled filenames and extensions in a directory that is served by the web server. This maps to CWE-434: Unrestricted Upload of File with Dangerous Type.
The downloadVideoFromDownloadURL() function writes the downloaded file to a temporary path under videos/cache/tmpFile/ based directly on the remote URL's name, including .php. Validation of parameters such as resolution, and any cleanup or relocation of the temporary file, occur after the file write. On invalid input, the code calls forbiddenPage() and terminates with die() before the cleanup and enforcement steps execute. The result is a PHP file, whose content is chosen by the attacker, sitting in a location that the web server interprets and executes. The unsafe combination of:
- trusting the remote filename and extension,
- writing to a web-accessible directory, and
- failing to clean up on error paths
produces a classic remote web shell / arbitrary code upload condition.
Potential impact
- Execution of arbitrary PHP code on the server by requesting the dropped file directly.
- Establishment of a persistent web shell for interactive access and further compromise.
- Reading or modification of application configuration and database contents via executed PHP code.
- Lateral movement to other services hosted on the same server or network.
- Defacement or modification of hosted video content and site behavior.
- Use of the compromised server for malware hosting, spam campaigns, or further attacks.
General mitigation guidance
Effective mitigation centers on constraining file handling, separating storage from execution, and hardening error paths:
- Avoid using attacker-controlled filenames and extensions; instead, generate server-side random names with a safe, non-executable extension (e.g.,
.bin,.dat) and store metadata separately. - Ensure that all upload or download staging directories are outside the web root or configured as non-executable in the web server (e.g., disabling PHP execution in cache/temp directories).
- Enforce strict allowlists for file types and content: validate by MIME type and, where practical, by inspecting headers or file signatures rather than relying on extensions.
- Normalize and validate all user-supplied parameters (including
resolution) before writing any files, so that invalid requests fail before disk writes occur. - Implement robust cleanup logic that is not bypassed by early termination; use structured error handling to guarantee that temporary files are deleted even on failures.
- Apply least-privilege principles to the web server and PHP interpreter so they cannot access or modify sensitive parts of the filesystem if compromised.
How teams detect issues like this
Detection approaches can combine code-level review with runtime monitoring:
- Static analysis and code review:
- Search for functions that download remote content (e.g.,
file_get_contents, cURL) followed by writes into paths under the web root. - Flag cases where filenames or extensions are derived directly from user input or remote URLs without normalization or restriction.
- Identify directories configured as writable and simultaneously exposed as executable by the web server.
- Review error-handling paths for
die(),exit, or early returns that occur after files are written but before cleanup. - Configuration and policy checks:
- Enforce policies that disallow executable interpreters (PHP, CGI, etc.) in cache or upload directories.
- Use automated configuration scanners to verify that
videos/cache/tmpFile/-like directories are non-executable or located outside the document root. - Runtime monitoring and logging:
- Log creation of files in upload/cache directories and alert on unexpected executable extensions.
- Monitor web server access logs for requests to cache or temporary directories, especially
.phprequests. - Integrate Web Application Firewalls (WAFs) to detect patterns indicative of file upload exploitation and web shell interaction.
- Automated tooling:
- Employ SAST tools configured with rules for CWE-434 to detect unsafe upload/download patterns.
- Use DAST scanners that attempt to upload and access executable payloads in various endpoints to uncover misconfigurations.

