Summary
OXID eShop 6.x prior to 6.3.4 contains a SQL injection vulnerability in the sorting parameter that can be abused to manipulate database content and inject PHP code.
When attackers can control this parameter in HTTP requests, they may persist malicious payloads in the database and ultimately execute arbitrary code via crafted URLs.
Affected context
This vulnerability arises in OXID eShop installations where user-controlled request parameters, specifically the sorting parameter, are used to build SQL queries for listing or ordering data.
It is relevant in contexts where:
- The
sortingparameter is accepted from GET or POST requests without strict allowlisting - Query fragments or ORDER BY clauses are built using string concatenation
- Application logic later interprets database content in a way that can trigger PHP execution (e.g., dynamic templates, eval-like behavior, or unsafe include mechanisms)
Exploit preconditions
- Attack surface: HTTP interface of the OXID eShop application (web storefront, sorting-related endpoints).
- Required access: Ability to send crafted requests to the application endpoints that accept the
sortingparameter (usually unauthenticated or low-privileged web access). - Trigger point: Application constructs SQL queries using the
sortingparameter without robust validation or parameterization, allowing malicious SQL fragments to be injected. - Why exploitation is possible: The code path uses string concatenation or interpolation with untrusted input to form SQL statements, enabling attackers to modify query structure, write crafted content into the database, and later have that content interpreted as PHP through other dynamic application behavior.
Why this happens
The underlying issue maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Instead of using parameterized queries or strict allowlists for sortable fields, the application incorporates the user-supplied sorting value directly into SQL statements.
This insecure pattern treats external input as part of the SQL syntax (e.g., column names, direction clauses, or even injected expressions), allowing attackers to alter queries, store unexpected data, and influence subsequent application behavior that reads and executes that data as code.
Potential impact
- Modification or insertion of arbitrary data into the OXID eShop database
- Injection of PHP code or malicious payloads into database-backed fields
- Execution of arbitrary PHP code via crafted URLs or application flows that read and interpret injected data
- Compromise of the web application, including potential takeover of the underlying hosting environment depending on configuration
- Exposure or tampering of customer data, orders, or configuration records
General mitigation guidance
Effective mitigation focuses on eliminating direct use of user input in SQL syntax and preventing any execution of code sourced from data:
- Use parameterized queries / prepared statements for all SQL operations, avoiding string concatenation for both values and structural elements wherever possible.
- Apply strict allowlisting for sortable fields: map a small set of known column identifiers (e.g.,
name,price,created_at) to fixed SQL fragments instead of passing user input directly into ORDER BY or similar clauses. - Normalize and constrain input for direction flags (e.g., translate only
asc/descto predefined constants). - Avoid patterns where database content can be interpreted as PHP or executable logic; store only data and treat it as such in templates and business logic.
- Apply least-privilege to the database user so that even if a query is manipulated, the account cannot perform dangerous operations beyond what is strictly necessary.
How teams detect issues like this
Organizations can detect similar vulnerabilities using multiple complementary approaches:
- Static analysis: Configure rules to flag dynamic SQL construction, especially where request parameters like
sortingare concatenated into query strings or ORDER BY clauses. - Code review: Examine controller and model code that handles list views and sorting; look for string-built queries and absence of allowlists or prepared statements.
- Runtime and log analysis: Monitor database logs for suspicious patterns (e.g., unexpected ORDER BY expressions, stacked queries, or anomalous function calls within SQL).
- Security testing: Use automated DAST tools or manual penetration tests to probe parameters used for sorting, filtering, and pagination for SQL injection behavior.
- Policy enforcement: Introduce internal coding standards that prohibit raw SQL concatenation and require parameterization and field allowlisting for all dynamic query components.

