/

CVE-2026-50890

Severity:

CRITICAL RISK

(9.8)

SQL Injection (CWE-89) in grocy stockreports module

CVE-2026-50890

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Data Confidentiality and Integrity Compromise

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 critical SQL injection vulnerability in grocy v4.6.0 affects the product-group parameter of the /stockreports/spendings endpoint, allowing crafted input to be interpreted as part of a database query.

Under conditions where user-controlled values are concatenated into SQL statements without proper sanitization, an attacker may access or manipulate sensitive database information.

Affected context

The vulnerability occurs in grocy v4.6.0 within the stock reporting functionality, specifically when handling the product-group parameter on the /stockreports/spendings route.

It is relevant in deployments where this endpoint is exposed to users who can influence the product-group value, and where backend code builds SQL queries using that parameter without robust parameterization or validation.

Exploit preconditions

  • Attack surface: HTTP interface exposing /stockreports/spendings
  • Required access: Ability to send requests with attacker-controlled product-group parameter
  • Trigger point: Processing of the product-group value during construction of a SQL query for spendings/stock reports
  • Why exploitation is possible: The application incorporates unsanitized user input directly into SQL statements instead of using bound parameters or safe query builders, enabling crafted input to alter query structure

Why this happens

This issue stems from building SQL statements by directly interpolating or concatenating the product-group parameter into the query string.

Such patterns bypass the protections provided by prepared statements and parameterized queries, allowing user-controlled data to change the semantics of the query rather than being treated solely as data.

Conceptually, this maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where input is not properly constrained, escaped, or parameterized before being sent to the database.

Potential impact

  • Access to sensitive database records that the attacker is not authorized to view
  • Enumeration of application tables, columns, and schema metadata
  • Modification or deletion of stock, inventory, or user-related data
  • Bypassing of application-level access controls enforced in the business logic
  • Potential pivoting to other vulnerabilities if database content is leveraged for further attacks

General mitigation guidance

Mitigation should focus on eliminating direct string concatenation of user input into SQL and enforcing strict separation between code and data.

Common defensive patterns include:

  • Using parameterized queries or prepared statements for all database interactions, including reporting features
  • Employing query builder or ORM layers that treat user input as bound parameters by default
  • Validating and constraining the product-group parameter to expected identifiers or enumerated values before use
  • Applying least-privilege to database accounts so that queries executed by the application have only the minimal required permissions
  • Centralizing database access patterns to make it easier to enforce secure defaults across all endpoints

How teams detect issues like this

Detection approaches typically combine code-level analysis with runtime monitoring:

  • Static analysis rules that flag string concatenation or formatting functions used to construct SQL commands, especially with HTTP parameters like product-group
  • Code review checklists emphasizing the use of parameterized queries and discouraging dynamic SQL composition without strict whitelisting
  • Automated testing or fuzzing that injects SQL meta-characters into parameters and observes anomalous database responses or errors
  • Database monitoring and logging policies that surface unusual query patterns, especially those containing raw user-supplied fragments

Sources

SourceLink
gist.github.comgist.github.com/pyuysig/92e631298ec28d3e6967ad1f2038e75d

Frequently asked

questions

Yes. If the /stockreports/spendings endpoint is reachable over the network, an attacker can exploit the issue remotely by sending crafted requests with malicious product-group values.

The attacker needs the ability to interact with the affected endpoint, which may require only basic application access if the reporting feature is exposed to regular users. No direct database access is required.

Replace any dynamic SQL string construction that uses product-group or similar parameters with parameterized queries or safe query builder APIs, and enforce strict validation on allowable values before they reach the data access layer.

Establish a development standard that all database operations use prepared statements, introduce secure coding guidelines and linters to flag unsafe SQL composition, and perform regular security-focused code reviews and automated scans of data access code paths.

Find out what's already
exploitable in your codebase.