Summary
Piwigo contains an unrestricted file upload vulnerability in its administrator logo upload workflow, where attacker-controlled filename extensions can survive MIME-based content validation. An authenticated administrator may cause image content to be stored with a server-executable extension, potentially enabling code execution when the file is requested under a web server that executes that extension.
Affected context
The issue occurs in Piwigo deployments where administrators can upload a logo through the standard themes administration functionality and the resulting file is stored in a web-accessible directory. Risk is higher when the application reuses an untrusted filename extension and the web server is configured to execute files with that extension.
Exploit preconditions
- Attack surface: Administrator-facing logo upload functionality
- Required access: Authenticated administrator privileges or equivalent ability to manage site logos
- Trigger point: Storage and subsequent web request for the uploaded logo
- Why exploitation is possible: MIME validation checks image content but the final stored filename can retain an attacker-controlled server-executable extension
- Environmental condition: The web server or runtime must interpret the stored extension as executable code
Why this happens
The underlying bug is a mismatch between content validation and filename handling. Although the uploaded content is checked as an image, the application reuses an attacker-controlled extension when constructing the stored filename. This maps to CWE-434, Unrestricted Upload of File with Dangerous Type, because a file upload path permits content to be placed in a web-accessible location with a potentially executable type.
Potential impact
- An attacker may execute arbitrary commands in the web application context
- Sensitive application data could be disclosed
- Application files or stored photos could be modified or deleted
- Persistence could be established within the affected hosting environment
- The web service could experience disruption or availability loss
General mitigation guidance
Mitigation generally focuses on treating uploaded filenames and extensions as
untrusted data rather than as storage instructions.
Common defensive patterns include:
- Generate server-side filenames and discard user-controlled extensions
- Permit only a strict set of image formats after content-based validation
- Store uploaded files outside the web document root where practical
- Configure upload directories to prevent script execution
- Serve uploaded content through a non-executable path or separate storage domain
- Apply least-privilege permissions to the application and web server processes
- Use consistent allowlists for MIME types, file signatures, and image decoding
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis rules that identify user-controlled extensions used in storage paths
- Code review checks for filename reuse after MIME or image-content validation
- Tests verifying that uploaded files receive server-generated, non-executable names
- Web-server policy checks for executable handlers enabled in upload directories
- Monitoring for unexpected executable extensions or script-like content in media paths
- Upload security policies that require storage outside executable web roots
Automated application security testing tools may help identify dangerous upload
handling when configured to assess authenticated administrator workflows.

