/

CVE-2026-25993

Severity:

CRITICAL RISK

(9.8)

SQL Injection in EverShop Category Event Handling

CVE-2026-25993

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution / Database 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

EverShop's category update and deletion handlers build SQL statements by concatenating path values derived from the url_key field, which originates from database data.

If an attacker succeeds in storing a malicious string in url_key, later event processing will embed that value into raw SQL and execute it, resulting in a second-order SQL injection even when the immediate HTTP request appears safe.

Affected context

This vulnerability appears in EverShop's category management workflow, specifically in the logic that reacts to category update and deletion events.

The problem occurs when values derived from the url_key column (e.g., path or request_path) are taken from the database and interpolated directly into SQL strings.

Deployments that allow user-controlled or partially trusted data to populate url_key—either via admin interfaces, import pipelines, custom integrations, or plugin modules—are at particular risk, since that data can later be reused unsafely inside dynamic SQL statements.

Exploit preconditions

  • Attack surface: Application workflows that create or modify category url_key values, and subsequent category update / delete events.
  • Required access: Ability to influence data that ends up in the url_key field (e.g., compromised admin account, malicious integration, or any feature that lets untrusted input populate category identifiers).
  • Trigger point: Execution of category update or deletion handlers that read the stored url_key, derive path / request_path, and construct SQL queries via string concatenation before calling execute().
  • Why exploitation is possible: The code treats database-resident values as inherently safe and interpolates them directly into SQL, bypassing parameterization and proper escaping. Because the malicious payload is stored and only executed later, usual request-time filters or WAF rules may not detect the exploit.

Why this happens

The underlying bug is the use of dynamic SQL construction with string concatenation, where values derived from url_key are inserted directly into SQL text.

This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

In this case, the injection is second-order: the attacker first stores crafted SQL meta-characters and fragments into the database; later, when event handlers construct new SQL statements using those stored values, the database interprets them as part of the command rather than as data.

The insecure pattern is assuming that data retrieved from internal storage is trusted and can be safely embedded into SQL without parameterization or validation.

Potential impact

  • Execution of attacker-controlled SQL against the application database
  • Reading or exfiltrating sensitive customer, order, or product data
  • Modifying or deleting catalog entries, orders, or user accounts
  • Creating backdoor administrative accounts or altering permissions
  • Tampering with transactional data, leading to financial fraud or inventory corruption
  • Potential pivoting to underlying infrastructure if the database has extended capabilities (e.g., file system access, command execution)

General mitigation guidance

Effective mitigation focuses on treating all data—whether from HTTP requests or from the database—as untrusted when building SQL.

Recommended defensive patterns include:

  • Using parameterized queries or query builders/ORM methods that clearly separate SQL structure from data, including for values that originate from the database itself.
  • Centralizing data access logic so that ad hoc string-concatenated SQL is discouraged or forbidden in application code and extensions.
  • Applying strict validation and normalization on fields like url_key, ensuring they follow a constrained format (e.g., slug / path-safe characters only) before storing them.
  • Implementing a clear distinction between identifiers and data, using whitelisting or mapping when identifiers must influence query structure.
  • Running the database with least-privilege accounts, limiting the damage that injected queries can cause, such as preventing schema changes or cross-database access.

These patterns help ensure that even if a field is compromised at one point in time, it cannot later be reinterpreted as executable SQL.

How teams detect issues like this

Identifying this class of issue typically involves combining code-level and behavioral analysis:

  • Static analysis: Configure SAST or linters to flag any usage of raw SQL string concatenation, especially where parts of the query are derived from variables, including values read from the database or request-dependent fields.
  • Code review: Pay attention to event handlers, hooks, and background jobs that read stored fields like url_key and then build SQL statements. Look for patterns where those fields control WHERE clauses, paths, or other query fragments.
  • Testing: Develop security tests that:
  • Store crafted values in url_key through legitimate workflows or test harnesses.
  • Trigger category update and delete operations to verify whether the stored values can alter the resulting SQL behavior.
  • Runtime monitoring: Enable database query logging or use a database firewall to detect anomalous patterns, such as unexpected concatenation of path-like values with SQL keywords or repeated query structure changes tied to specific records.

Automated code review and policy checks in CI/CD can enforce safer data access patterns before code reaches production.

Sources

SourceLink
github.comgithub.com/evershopcommerce/evershop/commit/5c5bdf2c1ad5d16ae68e9e48b494563953b6d1cd
github.comgithub.com/evershopcommerce/evershop/security/advisories/GHSA-3h84-9rhc-j2ch

Frequently asked

questions

Yes, in many deployments it can be. If a remote attacker can influence the url_key field—through admin features, compromised accounts, imports, or integrations—they can plant a payload that will later be executed by the event handlers, even if no direct SQL injection is obvious at request time.

The attacker needs a way to create or modify categories such that they can control url_key. This might require authenticated access (e.g., an admin or elevated role) or compromise of an integration or automation that feeds data into the catalog. Public-facing forms that feed into category metadata would significantly increase risk.

The most robust fix is to eliminate string-concatenated SQL in category event handling and instead use parameterized queries or ORM abstractions for all data values, including those read from the database. Complement this by normalizing and validating url_key values so that only well-formed, non-executable strings are stored.

Adopt a defensive coding standard that prohibits dynamic SQL string building wherever possible, enforce it with automated checks, and treat all persisted data as untrusted when it re-enters the application flow. Combine parameterized queries, strict input validation, code review focused on data/auth boundaries, and least-privilege database roles to reduce the likelihood and impact of second-order injections.

Find out what's already
exploitable in your codebase.