/

CVE-2026-38158

Severity:

CRITICAL RISK

(9.8)

SQL Injection (CWE-89) in UReport previewData API

CVE-2026-38158

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Compromise and Data Exposure

Severity:

CRITICAL RISK

(9.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

A SQL injection flaw in UReport v2.2.9's /ureport/datasource/previewData endpoint allows crafted SQL statements to be executed against the backend database.

When user-supplied parameters are concatenated into queries without proper sanitization, attackers can retrieve sensitive database information and potentially manipulate stored data.

Affected context

This vulnerability appears in UReport deployments that expose the /ureport/datasource/previewData component to users or integrated systems.

It typically occurs when request parameters used to preview data are passed directly into SQL statements without safe parameterization or validation.

Installations where the reporting service has broad database privileges and is reachable from untrusted networks are more susceptible to impactful exploitation.

Exploit preconditions

  • Attack surface: HTTP requests to the /ureport/datasource/previewData endpoint.
  • Required access: Ability to send crafted requests (usually via a web browser or API client); authentication requirements depend on local configuration.
  • Trigger point: The handling of preview data requests where user-controlled input is incorporated into SQL queries.
  • Why exploitation is possible: The component builds SQL statements by directly embedding user input rather than using parameterized queries or robust input validation, enabling attackers to alter the intended query structure.

Why this happens

The underlying bug aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

The application constructs SQL commands by concatenating user-supplied data into query strings for the previewData functionality.

Without parameterized queries or consistent input neutralization, special characters and SQL control tokens within attacker-supplied input are interpreted as part of the SQL syntax, allowing modification of the query's logic and scope.

Potential impact

  • Attackers may read sensitive tables and records beyond the intended preview scope.
  • Database contents could be modified, including insertion, update, or deletion of records.
  • Authentication data and application configuration stored in the database may be exposed.
  • In some environments, SQL injection could be leveraged to gain broader system access via database-specific features.
  • Reporting integrity can be compromised, leading to misleading or maliciously altered reports.

General mitigation guidance

Effective mitigation focuses on treating all data flowing into SQL as untrusted and constraining how it is used in query construction.

Recommended patterns include:

  • Using parameterized queries or prepared statements for all database interactions, especially dynamic report queries.
  • Separating query structure from user input, allowing only validated values (e.g., IDs, limited filter values) to be bound as parameters.
  • Applying strict allowlists for fields, operators, and filters that can be used in the previewData feature rather than passing raw expressions.
  • Reducing database privileges of the reporting component to the minimum necessary, avoiding direct access to highly sensitive tables where possible.
  • Designing query-building utilities that are secure by default and do not allow direct injection of arbitrary SQL fragments from callers.

How teams detect issues like this

Detection commonly combines code-focused and behavior-focused techniques:

  • Static analysis rules that flag dynamic SQL construction using string concatenation with request parameters or user input.
  • Code review checklists highlighting report-generation and data-preview features as high-risk areas requiring parameterization and input validation.
  • Centralized database access layers with linting or policy enforcement to prevent inline SQL and enforce prepared statement usage.
  • Runtime monitoring and logging for anomalous SQL patterns (e.g., queries containing UNION SELECT, comment markers, or stacked statements) originating from previewData requests.
  • Automated security testing tools, including web application scanners or DAST, that probe the endpoint with injection payloads and alert when the database responds with indicative errors or data leakage.

Sources

SourceLink
github.comgithub.com/musesix/cve/blob/main/ureport_sqli/ureport.md
github.comgithub.com/youseries/ureport

Frequently asked

questions

Exploitability depends on how the /ureport/datasource/previewData endpoint is exposed and whether access is authenticated. If reachable from untrusted networks or low-privilege accounts, attackers can often exploit it remotely by sending crafted requests.

An attacker typically needs the ability to send HTTP requests to the affected endpoint. In some deployments this may be possible without authentication; in others, a valid application account may be required, but not necessarily with elevated privileges.

The most reliable fix pattern is to eliminate string-based query construction and use parameterized queries exclusively. Inputs should be validated against strict schemas or allowlists, and any dynamic aspects of report queries should be constrained to safe, pre-defined options.

Establish a standard data access layer that enforces prepared statements, adopt secure coding guidelines for all database interactions, and integrate static analysis plus security-focused code review practices. Treat all user input as untrusted, validate it rigorously, and avoid building SQL directly from request parameters or UI-driven expressions.

Find out what's already
exploitable in your codebase.