/

CVE-2026-27834

Severity:

HIGH RISK

(7.2)

SQL Injection in Piwigo pwg.users.getList Web Service API

CVE-2026-27834

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution and Data Compromise

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 vulnerability in the pwg.users.getList web service API of Piwigo allows the filter parameter to be concatenated directly into SQL queries without proper sanitization.

When exploited by an authenticated administrator, this flaw can enable arbitrary SQL command execution against the Piwigo database, potentially exposing or modifying sensitive application data.

Affected context

The vulnerability occurs in Piwigo's web service layer, specifically within the pwg.users.getList API method used to retrieve user lists with filtering capabilities.

It becomes relevant in deployments where:

  • The web service API is enabled and accessible
  • Administrator-level accounts are present and used for API calls or through the web UI
  • The filter parameter is accepted from client input and passed into a database query

The issue is tied to how dynamic query fragments are constructed based on the filter parameter without adequate validation or parameterization.

Exploit preconditions

  • Attack surface: Piwigo web service endpoint pwg.users.getList, reachable over HTTP/HTTPS.
  • Required access: Valid authenticated administrator account (or equivalent role able to invoke the method with a custom filter parameter).
  • Trigger point: A crafted request to pwg.users.getList supplying a malicious filter value that alters the intended SQL query structure.
  • Why exploitation is possible: The implementation builds SQL statements by concatenating the filter parameter directly into the query string, rather than using parameterized queries or rigorous input validation, allowing attacker-controlled input to change the SQL logic.

Why this happens

This vulnerability is a classic instance of CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

The root cause lies in dynamically constructing SQL queries using string concatenation with user-controlled data (filter), instead of using prepared statements with bound parameters.

Because the application does not neutralize or validate special SQL meta-characters (such as quotes, operators, or comment delimiters), an attacker with administrative access can inject additional SQL clauses or statements, causing the database to execute unintended commands.

Potential impact

  • Retrieval of sensitive user information that would not normally be exposed through the interface
  • Unauthorized modification of user records, including roles, email addresses, or status flags
  • Creation or deletion of application data, potentially leading to loss of photo metadata or user accounts
  • Escalation of control over the application by manipulating administrative or configuration-related records stored in the database
  • Potential pivot into the underlying infrastructure if the database has unsafe configuration (e.g., filesystem access, extended procedures)

General mitigation guidance

Effective mitigation focuses on eliminating the pattern of concatenating user input into SQL statements and tightening input trust boundaries:

  • Refactor the affected query construction to use parameterized queries / prepared statements for all variable components.
  • Constrain the filter parameter to a well-defined set of allowed values or patterns (e.g., whitelisting specific fields and operators) and reject anything that does not match.
  • Centralize database access in a data-access layer that forbids ad-hoc string-built SQL and enforces parameterization by default.
  • Apply least-privilege to the database account used by the application so that, even if injection defects appear elsewhere, the account cannot perform destructive or administrative operations.
  • Introduce consistent input validation and normalization routines for web service parameters, especially those used to influence query conditions, sorting, or filtering.

How teams detect issues like this

Identifying and monitoring for this type of issue typically involves:

  • Static analysis rules targeting SQL construction patterns that use string concatenation with request parameters (e.g., spotting $sql .= $_REQUEST['filter'];-style patterns).
  • Code review checklists that explicitly require reviewers to verify that all database interactions use prepared statements and that filter/sort parameters are constrained to safe, enumerated values.
  • Application-level logging that records unusual or malformed filter values, enabling security teams to look for patterns indicative of injection attempts (e.g., presence of quotes, SQL keywords, or comment markers).
  • Integration of automated security testing tools (SAST/DAST) into CI/CD to flag endpoints where untrusted inputs flow into SQL query strings without parameterization.

Sources

SourceLink
github.comgithub.com/Piwigo/Piwigo/commit/9df471f16243371dc3725c5262e1632d23c8218a
github.comgithub.com/Piwigo/Piwigo/security/advisories/GHSA-5jwg-cr5q-vjq2
piwigo.orgpiwigo.org/release-16.3.0

Frequently asked

questions

Yes, it can be exploited remotely through the Piwigo web service interface or any feature that issues pwg.users.getList calls, provided the attacker can authenticate as an administrator and reach the endpoint over the network.

Yes. Exploitation requires valid administrator-level credentials or an account with equivalent privileges that can invoke pwg.users.getList with a controlled filter parameter.

The safest fix pattern is to replace all string-concatenated SQL with parameterized queries, restrict filterable fields and operators to a predefined whitelist, and ensure that query-building logic does not directly embed raw user input into SQL statements.

Prevention relies on adopting a secure-by-default data access layer that enforces parameterization, establishing coding standards that prohibit ad-hoc SQL string building, performing regular security-focused code reviews, and using automated analysis tools to detect unsafe query construction patterns before deployment.

Find out what's already
exploitable in your codebase.