/

CVE-2026-40887

Severity:

CRITICAL RISK

(9.1)

SQL Injection in Vendure Shop and Admin APIs via

CVE-2026-40887

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution / Data Compromise

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

Vendure's Shop API, and to a lesser extent the Admin API, contain a SQL injection vulnerability where a user-controlled query string parameter is interpolated directly into a raw SQL fragment.

An attacker can craft malicious input to execute arbitrary SQL against the underlying database on all supported backends, potentially leading to data exfiltration, modification, or service disruption.

Affected context

The vulnerability appears in Vendure deployments that:

  • Run versions starting from 1.7.4 up to (but not including) the patched lines 2.3.4, 3.5.7, and 3.6.2, and
  • Expose the Shop API (which is typically publicly accessible), and optionally the Admin API, and
  • Use code paths where the languageCode (or similar) query string parameter influences dynamically constructed SQL.

In this context, untrusted HTTP query parameters are interpolated directly into raw SQL expressions without parameterization or robust validation. All supported database engines (PostgreSQL, MySQL/MariaDB, SQLite) are affected, though actual impact depends on database privileges and schema design.

Exploit preconditions

  • Attack surface: HTTP endpoints of the Shop API; Admin API endpoints are also affected but usually behind authentication.
  • Required access:
  • Shop API: Unauthenticated network access to the API endpoint is sufficient.
  • Admin API: Valid authenticated user session, with access to affected operations.
  • Trigger point: Supplying crafted values in the vulnerable query string parameter (e.g., languageCode) so that it is interpolated into a raw SQL snippet.
  • Why exploitation is possible: The application concatenates user input directly into SQL without parameterization or strict validation, allowing an attacker to alter the structure of the executed query rather than just its data values.

Why this happens

This issue stems from constructing SQL statements using string interpolation that directly incorporates untrusted HTTP parameters. Instead of using prepared statements or query builder parameter binding, the implementation embeds user-supplied values (such as languageCode) directly into a raw SQL expression.

This pattern maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'). The SQL interpreter cannot distinguish between intended literals and attacker-supplied control characters (quotes, operators, comments), enabling the input to change the query's logic, combine multiple statements where allowed, or access data beyond the original intent.

Potential impact

  • Extraction of sensitive customer, order, product, or configuration data from the Vendure database
  • Unauthorized modification of business data, including prices, orders, and account information
  • Creation or escalation of user accounts or roles if the schema permits it
  • Deletion or corruption of tables and records, leading to data loss or service downtime
  • Abuse of database-specific features to pivot further into the hosting environment, depending on configuration and privileges

General mitigation guidance

Mitigation centers on eliminating direct string interpolation in SQL and reducing trust in user-controlled parameters:

  • Replace raw string concatenation with parameterized queries or a query builder that supports bound parameters for all user-controlled values.
  • Ensure that contextual fields like languageCode are validated at input boundaries against a strict allow-list of supported values (e.g., ISO language tags configured for the channel).
  • Prefer strongly typed abstractions (enums, IDs, reference objects) over free-form strings when passing user input into query layers.
  • Apply least-privilege principles at the database level so that the application account only has the permissions strictly required for normal operation.
  • Enforce centralized input validation for repeated parameters (like language or locale) and reuse that logic consistently across APIs.

How teams detect issues like this

Effective detection typically combines code-level analysis with runtime monitoring:

  • Static analysis: Configure SAST tools or lints to flag direct string concatenation in SQL construction, especially where HTTP request parameters or query strings are involved.
  • Code review: Treat any raw SQL usage as a high-risk area; reviewers should look for:
  • Direct interpolation of request parameters or GraphQL/REST arguments into SQL.
  • Bypassing ORM/query builder parameter binding features.
  • Repeated patterns of manual query construction that do not enforce allow-lists.
  • Runtime monitoring: Use database activity monitoring and application logs to detect anomalous queries (e.g., unexpected UNION, comments, or tautological conditions commonly associated with injection attempts).
  • Security testing: Incorporate automated DAST or API security scanning to probe query parameters for SQL injection behavior in non-production environments.

Sources

SourceLink
github.comgithub.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v

Frequently asked

questions

Yes. The Shop API exposure is remote and unauthenticated in typical deployments, meaning anyone with network access to the API can attempt exploitation. The Admin API variant is also remote but generally gated by authentication.

For the Shop API, only network access to the affected endpoint and the ability to send crafted HTTP requests is required. For the Admin API, the attacker must first obtain valid credentials or otherwise gain an authenticated session with enough access to reach the vulnerable code path.

The most robust fix is to eliminate unsafe SQL construction by using parameterized queries everywhere user input reaches the database and to enforce strict validation or allow-listing for contextual parameters like languageCode. Centralizing this logic in a shared service or helper reduces the chance of regressions.

Adopt a defensive development baseline where raw SQL usage is rare, code-reviewed carefully, and backed by automatic checks that flag string-interpolated queries. Combine this with boundary validation for all externally sourced input, least-privilege database accounts, and regular security testing of API endpoints to detect injection flaws early in the development lifecycle.

Find out what's already
exploitable in your codebase.