Summary
A path traversal vulnerability in Piwigo's Image Derivative Handler may allow remote attackers to access files outside the intended image-processing directory.
The issue becomes risky when externally influenced path values are accepted by i.php without sufficiently restricting them to approved filesystem locations.
Affected context
The vulnerability affects Piwigo installations through functionality in i.php that handles image derivatives. It may be present when request-controlled path information is used to locate or process files without robust canonicalization, containment checks, or equivalent path restrictions. Remote exploitation is possible through an exposed web application, although the accessible files depend on operating-system permissions and application behavior.
Exploit preconditions
- Attack surface: The publicly reachable
i.phpImage Derivative Handler - Required access: Network access to the affected Piwigo application; authentication requirements may vary by deployment
- Trigger point: Processing a request containing path-related input
- Why exploitation is possible: Insufficient validation or normalization may allow an attacker-controlled path to resolve outside the intended directory
Why this happens
The underlying bug is improper restriction of user-influenced filesystem paths. When an application combines request data with local paths without canonicalizing the result and verifying that it remains within an allowed directory, traversal sequences or equivalent path representations may escape the expected location.
This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.
Potential impact
- An attacker may read files that the web process can access
- Sensitive application configuration or metadata could be exposed
- Files may potentially be altered or removed if the affected operation permits writing
- Credentials or secrets found in accessible files could support further compromise
- Website content or image-processing workflows could be disrupted
General mitigation guidance
Mitigation generally focuses on treating all path-related request data as untrusted and enforcing directory containment.
Common defensive patterns include:
- Resolve paths to canonical form before file access
- Verify that resolved paths remain within explicitly permitted directories
- Prefer server-generated file identifiers or allowlisted names over client-supplied paths
- Reject traversal markers, alternate separators, and ambiguous path encodings as defense-in-depth
- Apply least-privilege permissions to the web process and image directories
- Keep sensitive configuration and operating-system files outside application-readable locations where practical
How teams detect issues like this
Organizations can look for path traversal risks through:
- Static analysis rules for filesystem APIs receiving request-derived values
- Code review checks for missing canonicalization and directory-containment validation
- Web application firewall or reverse-proxy policies covering traversal patterns and encoded variants
- Server logs showing unusual path parameters, repeated encoding, or requests targeting unexpected file types
- Automated security testing that verifies access remains confined to approved directories

