Summary
A missing authorization check in Piwigo's pwg.history.search API allows unauthenticated users to query the complete browsing history of gallery visitors.
When exposed, this endpoint can leak sensitive behavioral and potentially identifying information about users' interactions with the photo gallery.
Affected context
This vulnerability affects Piwigo deployments where the pwg.history.search API endpoint is reachable from the network (e.g., public or internal web access).
The issue occurs because the method is registered without the admin_only (or equivalent access control) flag, meaning no authentication or role check is enforced before returning browsing history data.
Any HTTP client capable of reaching the Piwigo API can query the viewing history of gallery visitors, regardless of whether the gallery itself requires login to browse images.
Exploit preconditions
- Attack surface: Piwigo web API, specifically the
pwg.history.searchmethod. - Required access: Network access to the Piwigo instance; no authentication or valid user session is required.
- Trigger point: Sending a crafted request to
pwg.history.search(e.g., via HTTP POST/GET with appropriate parameters). - Why exploitation is possible: The API method is registered without an
admin_onlyor equivalent authorization requirement, resulting in an unprotected endpoint that exposes sensitive history data.
Why this happens
The root cause is a missing authorization control on a sensitive backend function, aligning with CWE-862: Missing Authorization.
The API registration logic treats pwg.history.search as a generic method and omits the flag or configuration that limits access to administrative or authenticated users.
As a result, the access control layer never checks whether the caller has sufficient privileges before serving detailed browsing history, violating the principle of least privilege and exposing data that should be restricted.
Potential impact
- Exposure of detailed browsing history for all gallery visitors, including which images or albums they viewed and when.
- Inference of user interests, habits, or behavioral patterns that may be sensitive in certain contexts (e.g., private or themed galleries).
- Potential de-anonymization when browsing history can be correlated with IP addresses, usernames, or session identifiers.
- Increased risk of targeted social engineering or harassment based on observed viewing behavior.
- Privacy non-compliance where regulations or policies require protection of user activity logs.
General mitigation guidance
Effective mitigation focuses on enforcing explicit authorization on sensitive API endpoints and treating history/audit data as protected resources.
Pattern-based defensive measures include:
- Defining a clear access-control policy for all API methods, especially those exposing logs, history, or analytics.
- Requiring authentication and appropriate roles (e.g., admin, auditor) for any endpoint that returns other users' activity.
- Centralizing API registration or routing so that endpoints must declare their authorization requirements (e.g.,
admin_only,authenticated_only) and defaulting to "deny" when not specified. - Applying the principle of least privilege by returning only the minimum necessary information and, where appropriate, aggregating or anonymizing history data.
- Conducting security reviews of new or modified API methods to ensure that changes to access control are intentional and documented.
How teams detect issues like this
Organizations can identify similar issues using a combination of design review, code analysis, and runtime monitoring:
- Static analysis & code scanning: Flag API registration calls where authorization flags (such as
admin_onlyor role requirements) are absent for methods operating on sensitive data. - Manual code review: Inspect controllers, route definitions, and API handlers to confirm that every endpoint passes through a centralized authorization layer, and that history/log-related methods require privileged roles.
- Configuration and policy checks: Enforce architectural rules that no endpoint may bypass the authentication/authorization middleware; violations should be treated as build or deployment blockers.
- Runtime monitoring: Analyze access logs for patterns where sensitive endpoints (e.g., history, audit, analytics APIs) are frequently accessed by unauthenticated or anonymous clients, which may indicate missing controls.
- Automated API security testing tools can also help discover unauthenticated access paths to sensitive methods during pre-production testing.

