/

CVE-2026-71288

Severity:

HIGH RISK

(8.8)

SQL Injection (CWE-89) in Koha Guided Report Builder

CVE-2026-71288

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Information Disclosure

Severity:

HIGH RISK

(8.8)

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

Koha's guided report builder incorporates user-controlled sorting parameters directly into an SQL ORDER BY clause without an allowlist or validation. A staff user with report creation or execution permissions may be able to perform time-based blind SQL injection, potentially exposing sensitive database information.

Affected context

The vulnerability occurs in Koha's guided report builder when the order_by CGI parameter and its dynamically named companion value are used to construct a report query. It is relevant where low-privilege staff accounts have the create_reports or execute_reports permission and the resulting query reaches a database containing patron, staff, or authentication-related information.

Exploit preconditions

  • Attack surface: Koha's guided report builder web interface
  • Required access: An authenticated staff account with report creation or execution privileges
  • Trigger point: Processing user-controlled ordering parameters while assembling a report query
  • Why exploitation is possible: Column and ordering values are concatenated into an SQL ORDER BY clause without an explicit allowlist, validation, or escaping

Why this happens

The underlying flaw is direct concatenation of request-controlled values into SQL syntax. Because SQL identifiers and ordering directions generally cannot be safely supplied through ordinary prepared-statement value placeholders, the application must map accepted inputs to known-safe server-side options; that control is absent here. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.

Potential impact

  • An attacker may infer database information through timing behavior
  • Sensitive patron records could be exposed
  • Staff or directory-service credentials could be disclosed
  • Database integrity could be affected if broader query manipulation becomes possible
  • The incident could enable follow-on compromise of connected systems

General mitigation guidance

Mitigation generally focuses on removing request-controlled SQL structure and reducing the trust placed in report parameters.

Common defensive patterns include:

  • Mapping accepted sort fields and directions to fixed server-side allowlists
  • Rejecting unknown, duplicated, or malformed ordering values before query construction
  • Keeping SQL identifiers separate from user-supplied data and using parameter binding wherever values are involved
  • Limiting report permissions according to least privilege and separating report execution from sensitive data access
  • Restricting database accounts used by reporting features to the minimum required operations and datasets
  • Applying consistent validation and authorization controls across all report-building paths

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules that flag string interpolation or concatenation near SQL query construction
  • Code review searches for request parameters inserted into clauses such as ORDER BY, GROUP BY, or LIMIT
  • Tests that submit unexpected ordering names and directions and verify strict rejection
  • Database monitoring for unusual report-query timing, repeated failed queries, or abnormal access to sensitive tables
  • Policy enforcement requiring allowlists for SQL identifiers and centralized query-building abstractions

Automated code review and application security testing tools may help identify these patterns, but database-aware manual review remains useful for report-generation code.

Sources

SourceLink
github.comgithub.com/Koha-Community/Koha
github.comgithub.com/Koha-Community/Koha/blob/master/reports/guided_reports.pl

Frequently asked

questions

It can be triggered through Koha's web interface by an authenticated staff user who has the required report permissions; it does not generally require operating-system access to the server.

No. The described permission set can include non-administrative library staff accounts, although the exact scope depends on local role configuration.

Use a strict server-side allowlist that maps permitted sort fields and directions to fixed SQL fragments, while parameterizing ordinary data values and rejecting all other input.

Review every report and query-builder parameter for SQL structural injection, enforce least-privilege reporting permissions, use centralized safe query construction, and monitor access to sensitive database records.

Find out what's already
exploitable in your codebase.