/

CVE-2026-62262

Severity:

CRITICAL RISK

(9.1)

SQL Injection (CWE-89) in Piwigo Public Rating Search

CVE-2026-62262

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Information Disclosure

Severity:

CRITICAL RISK

(9.1)

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 public rating-based image search flow when ratings are enabled. An unauthenticated guest may influence a search parameter and potentially extract database information through error-based or blind techniques, including database-dependent timing behavior.

Affected context

The issue affects Piwigo deployments where image ratings are enabled and unauthenticated users can access the public filtered-search workflow. It becomes risky when rating-bound input is stored in search rules without complete validation and is later incorporated into SQL statements without reliable parameterization.

Exploit preconditions

  • Attack surface: Public web-based image search functionality
  • Required access: No authentication; an unauthenticated guest may be sufficient
  • Trigger point: Creation and opening of a filtered-search URL containing a crafted rating value
  • Why exploitation is possible: The upper rating bound can reach SQL construction without adequate validation or parameter binding, allowing database behavior to be influenced through the search flow

Why this happens

The vulnerability results from incomplete validation and unsafe SQL construction for a user-controlled rating boundary. Although one rating bound is converted to an integer, the corresponding upper-bound value is retained and concatenated into a database query. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, where application input is treated as query syntax instead of being handled exclusively as data.

Potential impact

  • An attacker may infer database contents through error-based or blind responses
  • An attacker could use timing behavior to distinguish database results
  • Sensitive application or user data may be disclosed
  • Database availability could be affected by expensive or repeated queries
  • The vulnerability may provide a foundation for further compromise depending on database permissions and application configuration

General mitigation guidance

Mitigation generally focuses on removing user-controlled SQL construction and reducing trust in public search parameters.

Common defensive patterns include:

  • Use parameterized queries or prepared statements for every dynamic search value
  • Apply strict allowlist validation and type enforcement before values enter query logic
  • Validate the complete rating range rather than converting only selected bounds
  • Keep query construction separate from request parsing and presentation-layer URL handling
  • Run the application database account with the minimum permissions required
  • Limit unnecessary unauthenticated search functionality or apply suitable rate and resource controls
  • Return generic database errors and avoid exposing query diagnostics to clients

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis rules for SQL string concatenation involving request parameters
  • Code review checks for numeric-looking inputs that are validated inconsistently across bounds
  • Tests that exercise public search endpoints with malformed, boundary, and unexpected type values
  • Database monitoring for unusual error rates, repeated conditional queries, or timing-oriented request patterns
  • Web-application firewall or API policy rules that restrict suspicious search parameters while application-level fixes are developed
  • Automated security testing and code-review tools that flag unparameterized query construction

Sources

SourceLink
github.comgithub.com/Piwigo/Piwigo/commit/9755d88edf38b94bafdedb0b3aba7304a94e2e5c
github.comgithub.com/Piwigo/Piwigo/commit/aede490a0b3a6c246f1f4689ca86c8fee377a7ae
github.comgithub.com/Piwigo/Piwigo/security/advisories/GHSA-hq29-8hhx-5jwc

Frequently asked

questions

Yes. The affected search flow is exposed through the web application, and the described behavior may be reachable by an unauthenticated guest when ratings are enabled.

No authenticated account is expected to be necessary. The attacker needs network access to the public Piwigo search functionality.

The safest pattern is to use parameterized database queries for all rating bounds and to enforce strict, complete type and range validation before query execution.

Combine parameterized queries, centralized input validation, least-privileged database accounts, safe error handling, and automated testing of public request parameters.

Find out what's already
exploitable in your codebase.