/

CVE-2026-42322

Severity:

CRITICAL RISK

(9.1)

Unrestricted Upload (CWE-434) in Piwigo Logo Handler

CVE-2026-42322

Deferred

Vulnerability type

Category:

Unrestricted File Upload

CWE:

CWE-434

Impact:

Potential Remote Code Execution

Severity:

CRITICAL RISK

(9.1)

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

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.

Sources

SourceLink
github.comgithub.com/Piwigo/Piwigo/commit/1e7f7262cb30e6916779f93e66d5d6579ec75a11
github.comgithub.com/Piwigo/Piwigo/commit/4a13ec9a8f4881ae1f23bdfd24d7b90cd0802cdc
github.comgithub.com/Piwigo/Piwigo/releases/tag/16.4.0
github.comgithub.com/Piwigo/Piwigo/security/advisories/GHSA-7w97-5g4p-xqvv

Frequently asked

questions

Exploitation generally requires an authenticated administrator or another

identity with permission to upload or manage site logos.

No. Code execution depends on the uploaded file being placed in a web-accessible

location and the server being configured to execute its resulting extension.

Generate storage names on the server, restrict uploads to validated image types,

and ensure media directories cannot execute server-side code.

Treat filenames, extensions, and MIME declarations as untrusted; validate file

signatures, isolate uploaded content from executable web paths, and enforce

least-privilege and web-server upload policies.

Find out what's already
exploitable in your codebase.