/

CVE-2026-42323

Severity:

HIGH RISK

(7.2)

SQL Injection (CWE-89) in Piwigo Batch Manager Filters

CVE-2026-42323

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database compromise and data integrity disruption

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

Piwigo contains a SQL injection vulnerability in the Batch Manager filter handling logic because administrator-supplied dimension and filesize values from filter URLs are not validated as numeric data. An authenticated administrator may be able to inject SQL expressions that disclose, modify, or disrupt database information when the stored filter state is later used to build queries.

Affected context

The issue occurs in Piwigo's Batch Manager when filter values are supplied through the URL-based filtering path. Width, height, ratio, and filesize values can be stored in session state without the numeric validation applied by the corresponding POST filter path, after which they may be concatenated into SQL predicates.

Exploit preconditions

  • Attack surface: The Batch Manager filter URL and its session-backed query path
  • Required access: An authenticated account with administrator privileges
  • Trigger point: Processing a crafted filter request followed by query construction using the stored filter state
  • Why exploitation is possible: Numeric-looking filter parameters are accepted without strict validation and are later incorporated into SQL predicates as query text

Why this happens

The underlying bug is a failure to preserve the boundary between data and SQL syntax. The URL filter parser accepts values that should be numeric, stores them without equivalent validation, and later constructs predicates through string concatenation. This behavior maps to CWE-89 because attacker-influenced input can alter the intended SQL statement rather than being handled solely as parameter data.

Potential impact

  • An attacker may disclose database records or metadata.
  • An attacker could modify data if the database account permits the relevant operations.
  • Crafted expressions may disrupt database availability or application behavior.
  • Sensitive gallery, user, or administrative information could be exposed.

General mitigation guidance

Mitigation generally focuses on enforcing a single trusted input-handling

pattern across every filter entry point.

Common defensive patterns include:

  • Using parameterized queries or prepared statements for all dynamic predicates.
  • Applying strict allowlisted numeric parsing and range validation before values enter application state.
  • Treating URL parameters and session-derived values as untrusted, even when only administrators can submit them.
  • Reusing the same validation and query-building logic for GET, POST, and other request paths.
  • Limiting database privileges so the application account cannot perform unnecessary destructive or administrative operations.
  • Avoiding query construction through string concatenation and centralizing database access policy.

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings involving SQL string concatenation with request, URL, or session values.
  • Code-review signals where numeric parameters are validated on one request path but not another.
  • Tests that submit nonnumeric, boundary, and SQL-expression-like values to every filter endpoint.
  • Database monitoring for unusual predicate structures, time delays, error patterns, or unexpected access to sensitive tables.
  • Application policy checks requiring prepared statements and centralized input validation.

Automated code-review and security-analysis tools may help identify inconsistent validation and unsafe query construction.

Sources

SourceLink
github.comgithub.com/Piwigo/Piwigo/commit/c7e30da5c1775b531ce9a30aac04134cd714b472
github.comgithub.com/Piwigo/Piwigo/commit/e4f0989d350d66207066ea61f8ee8c137164fb2f
github.comgithub.com/Piwigo/Piwigo/releases/tag/16.4.0
github.comgithub.com/Piwigo/Piwigo/security/advisories/GHSA-7r67-9xhq-7p2c

Frequently asked

questions

Exploitation generally requires an authenticated account with administrator

privileges or equivalent access to the Batch Manager filtering functionality.

It may be reachable through web requests, but the attacker must first satisfy

the application's authentication and authorization requirements. Network

reachability alone is not sufficient.

Use parameterized queries for all filter predicates and strictly parse and

validate values expected to be numeric before storing or using them.

Apply identical validation and query-handling rules across all request paths,

treat session state as untrusted input, use least-privileged database

accounts, and test administrative endpoints for injection behavior.

Find out what's already
exploitable in your codebase.