/

CVE-2026-33647

Severity:

HIGH RISK

(8.8)

Unrestricted File Upload in WWBN AVideo Image Gallery

CVE-2026-33647

Analyzed

Vulnerability type

Category:

Unrestricted File Upload

CWE:

CWE-434

Impact:

Remote Code Execution via Web-Accessible Uploaded Files

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

WWBN AVideo's ImageGallery::saveFile() method accepts uploaded images based on MIME type detection but preserves user-controlled file extensions when saving.

An attacker can upload a polyglot file that looks like a JPEG to the MIME checker but has a .php extension and embedded PHP code, resulting in a web-accessible executable script and enabling remote code execution under typical PHP configurations.

Affected context

This vulnerability appears in AVideo deployments that:

  • Allow users to upload images through the Image Gallery feature.
  • Use ImageGallery::saveFile() to persist uploaded content.
  • Run PHP in the same web-accessible directory (or subdirectories) used for storing uploaded files.
  • Rely on MIME type detection alone to validate uploads while preserving the original filename extension.

In such contexts, user-supplied filenames can determine the final file extension despite server-side file content checks, creating an inconsistency between perceived file type and server execution behavior.

Exploit preconditions

  • Attack surface: HTTP(S) file upload endpoints exposed by the AVideo Image Gallery.
  • Required access: Ability to upload image files (e.g., an authenticated user role allowed to upload images, or any public upload point if misconfigured).
  • Trigger point: Submission of a crafted upload request containing:
  • A polyglot payload with valid JPEG magic bytes so finfo reports an image MIME type.
  • A filename ending in .php (or another executable extension interpreted by the server).
  • Why exploitation is possible:
  • The application validates content with finfo but does not constrain or normalize the output filename extension.
  • The uploaded file is stored in a directory where the web server executes .php files.
  • When an attacker accesses the uploaded .php file via HTTP, the embedded code is interpreted by the PHP engine.

Why this happens

The underlying bug is a form of unrestricted file upload where validation is applied to file content but not to the resulting filename or execution context.

Specifically, ImageGallery::saveFile():

  • Uses finfo to check that the file content appears to be an image.
  • Still derives the stored filename (including extension) from user input without enforcing an allowlist of safe extensions or normalizing to a non-executable type.

This mismatch between content-based validation and extension-based execution maps directly to CWE-434: Unrestricted Upload of File with Dangerous Type, because files that the server can execute are allowed to be uploaded and placed in executable paths.

Potential impact

  • Execution of arbitrary PHP code on the server, leading to full remote code execution.
  • Reading or modification of sensitive data accessible to the web application.
  • Installation of web shells or backdoors for persistent access.
  • Use of the compromised server as a pivot point to attack internal systems.
  • Defacement, data exfiltration, or manipulation of hosted video and media content.

General mitigation guidance

Effective mitigation centers on aligning upload validation with how the web server treats stored files:

  • Enforce a strict allowlist of file extensions (e.g., .jpg, .jpeg, .png, .gif) regardless of user-supplied filenames.
  • Generate server-side filenames independent of user input, using random identifiers and fixed safe extensions.
  • Store uploaded files in directories that are not executable by the web server, such as dedicated storage paths or outside the document root, and serve them through controlled endpoints or proxies.
  • Combine MIME type validation using finfo with additional checks such as validating file headers and size to reduce malformed or polyglot uploads.
  • Apply least-privilege configuration for the web server and PHP runtime so that compromise of file upload handling yields minimal additional privileges.

How teams detect issues like this

Detection often involves reviewing how file uploads are processed and where they are stored:

  • Static analysis and code review:
  • Look for file upload handlers that:
  • Use $_FILES or equivalent to save user-supplied files.
  • Preserve the original filename or extension when saving to disk.
  • Write files into web-accessible and executable directories.
  • Flag code paths that validate only MIME type or magic bytes without constraining extensions.
  • Configuration and policy checks:
  • Verify web server and PHP configurations so that upload directories do not allow code execution.
  • Enforce policies requiring random, safe filenames and non-executable storage for all user uploads.
  • Runtime and log analysis:
  • Monitor web server logs for requests to uploaded paths with executable extensions (e.g., .php, .phtml) or unusual access patterns.
  • Use intrusion detection or web application firewalls to flag access to newly uploaded executable files.

Sources

SourceLink
github.comgithub.com/WWBN/AVideo/commit/345a8d3ece0ad1e1b71a704c1579cbf885d8f3ae
github.comgithub.com/WWBN/AVideo/security/advisories/GHSA-wxjw-phj6-g75w

Frequently asked

questions

Yes. If an attacker can reach the image upload functionality over the network and the uploaded files are stored in a web-executable directory, they can achieve remote code execution by uploading a crafted polyglot file.

That depends on how the AVideo instance is configured. If uploads are restricted, an attacker must obtain an account or compromise a user with upload permissions. If uploads are allowed to anonymous users, no authentication is required.

The safest pattern is to decouple user input from stored filenames and execution contexts: always generate server-side filenames with a fixed, allowlisted extension and place them in non-executable storage locations, while validating both MIME type and structure of the file.

Establish a standard upload framework that mandates allowlisted extensions, non-executable storage directories, and server-controlled filenames. Integrate secure upload patterns into code review checklists and automated scanning so that new upload endpoints are consistently evaluated for dangerous file types and execution risk.

Find out what's already
exploitable in your codebase.