/

CVE-2026-27885

Severity:

HIGH RISK

(7.2)

SQL Injection in Piwigo Activity List API Endpoint

CVE-2026-27885

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Sensitive Data Exposure via Authenticated SQL Injection

Severity:

HIGH RISK

(7.2)

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

A SQL injection flaw in Piwigo's Activity List API endpoint allows an authenticated administrator to manipulate database queries and extract sensitive information.

When exploited, this issue can expose user credentials, email addresses, and all stored gallery content by injecting crafted SQL into backend queries.

Affected context

This vulnerability arises in Piwigo deployments that expose the Activity List API endpoint and rely on dynamically constructed SQL queries based on request parameters.

The issue manifests when user-controlled input—originating from an authenticated administrator session—is interpolated into SQL statements without robust parameterization or validation.

While the attack surface is restricted to authenticated administrators, any compromised or shared admin account, or an admin operating within a malicious browser context, can become an effective vector.

Exploit preconditions

  • Attack surface: Piwigo web application, specifically the Activity List API endpoint.
  • Required access: Valid authenticated administrator session with permission to access the Activity List feature.
  • Trigger point: Submission of crafted input parameters that are incorporated into SQL queries executed by the Activity List endpoint.
  • Why exploitation is possible: The backend combines administrator-controlled input with SQL statements in an unsafe way, lacking strict parameter binding, allowing the injected input to alter the intended query structure and return arbitrary database records.

Why this happens

The core issue maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

Application logic builds SQL queries for the Activity List endpoint by concatenating or interpolating request parameters directly into SQL strings instead of using prepared statements with bound parameters and strict typing.

Because the input is not consistently validated or encoded within a parameterized context, an attacker with admin access can introduce SQL control characters and clauses that change the semantics of the query, enabling data extraction beyond the intended scope.

Potential impact

  • An attacker may retrieve user credentials stored in the database (e.g., password hashes).
  • An attacker may access users' email addresses and profile information.
  • An attacker may enumerate and exfiltrate all photo metadata and associated content records.
  • An attacker could discover internal application configuration data stored in the database.
  • Depending on database configuration, an attacker might pivot to read additional sensitive tables used by plugins or extensions.

General mitigation guidance

Effective mitigation focuses on removing dynamic SQL construction paths for the Activity List endpoint and similar features:

  • Use parameterized queries or prepared statements consistently, binding all external inputs as parameters rather than concatenating them into SQL strings.
  • Apply strict input validation and canonicalization on query parameters (e.g., whitelisting expected values such as enumerations, column names, sort directions, and limits).
  • Separate query logic from presentation logic so that filtering, ordering, and pagination are implemented through controlled mappings rather than direct user-driven SQL fragments.
  • Minimize the sensitivity of data accessible from any single administrative function, enforcing least privilege within the application's internal query layer.
  • Introduce secure-by-default database access patterns through shared utility functions or ORM APIs that make unsafe query construction harder or impossible.

How teams detect issues like this

Organizations can identify and monitor for this class of issue through a combination of review and runtime controls:

  • Static analysis: Configure tools or custom rules to flag string-based SQL construction, especially where request parameters or admin-controlled variables are concatenated into queries.
  • Code review: During peer review, treat any raw SQL usage as high-risk; verify that all parameters are bound, and that filter/sort options come from controlled mappings rather than raw input.
  • Security testing: Use authenticated SQL injection testing as part of regular application security assessments, including targeted testing of admin-only APIs and dashboards.
  • Logging and monitoring: Analyze database and application logs for anomalous queries with unusual operators, stacked statements (if supported), or patterns inconsistent with normal Activity List operations.
  • Policy enforcement: Adopt coding guidelines that mandate ORMs or query builders with prepared statements, and enforce these patterns in CI through linters or security-focused quality gates.

Sources

SourceLink
github.comgithub.com/Piwigo/Piwigo/commit/c172d284e11eab4a5dbadd2844d26f734d5c8c72
github.comgithub.com/Piwigo/Piwigo/security/advisories/GHSA-wfmr-9hg8-jh3m
piwigo.orgpiwigo.org/release-16.3.0

Frequently asked

questions

Exploitation occurs through the Piwigo web interface, specifically the Activity List API endpoint. While the database is not directly exposed, malicious requests sent via a browser or scripted HTTP client to the application can carry the injected SQL payload.

Yes. The vulnerable functionality is accessible to authenticated administrators. However, if an attacker can compromise an administrator account (e.g., via credential theft, phishing, or reused passwords), they can leverage this vulnerability to extract additional sensitive data.

Replace any dynamic SQL building in the Activity List endpoint with parameterized queries or ORM methods, ensuring that all user- or admin-controlled input is bound as parameters. At the same time, restrict the shape and range of inputs through strict validation and controlled mappings for filters and sort options.

Standardize on secure data-access layers that default to prepared statements, prohibit ad-hoc string-based SQL in code review, and incorporate static analysis plus security tests for all new endpoints—especially admin and reporting interfaces that expose flexible filtering and querying capabilities.

Find out what's already
exploitable in your codebase.