Summary
DataEase versions 2.10.20 and below contain a SQL injection vulnerability in dataset-related APIs where the orderDirection parameter is inserted directly into an ORDER BY clause.
An authenticated attacker can abuse the sorting direction field to inject arbitrary SQL, enabling time-based blind data extraction and denial of service when dataset queries are executed.
Affected context
The vulnerability occurs in DataEase's dataset-related HTTP endpoints, notably /de2api/datasetData/enumValueDs and /de2api/datasetTree/exportDataset, when they construct SQL queries to retrieve or export data.
It manifests when the backend Order2SQLObj class takes the user-supplied orderDirection parameter and passes it into the SQL ORDER BY clause without validation or whitelisting.
This issue is relevant where these APIs are exposed to authenticated users, and the underlying database engine executes dynamically built SQL constructed from request parameters.
Exploit preconditions
- Attack surface: Dataset-related HTTP API endpoints, including
/de2api/datasetData/enumValueDsand/de2api/datasetTree/exportDataset. - Required access: Valid, authenticated access to DataEase with permission to trigger dataset queries that accept the
orderDirectionparameter. - Trigger point: Submission of crafted
orderDirectionvalues that are incorporated into theORDER BYclause and executed by the database. - Why exploitation is possible: The
Order2SQLObjclass concatenates unvalidated, user-controlledorderDirectiondirectly into an SQL template rendered byStringTemplate, bypassing parameterization and allowing arbitrary SQL fragments to influence query execution.
Why this happens
The underlying flaw is a classic SQL Injection (CWE-89) issue caused by dynamic query construction using untrusted input.
Instead of treating orderDirection as data, the implementation interpolates it into the SQL ORDER BY clause as executable syntax, without enforcing a strict whitelist (e.g., only ASC or DESC) or using parameterized expressions.
This design couples user-controlled strings with query structure, allowing an attacker to alter the semantics of the query and execute additional SQL logic through time-based blind techniques or other injection patterns.
Potential impact
- An attacker may perform time-based blind SQL queries to infer and exfiltrate sensitive data stored in the database.
- The application could be forced into expensive or blocking SQL operations, leading to partial or full denial of service for dataset-related functionality.
- Depending on database configuration and permissions, an attacker might modify or delete data, impacting integrity and availability.
- Logging and monitoring systems that rely on database queries can be disrupted or polluted through injected statements.
General mitigation guidance
Effective mitigation focuses on treating sort parameters as controlled values rather than executable query fragments.
Pattern-based defenses include:
- Restricting
orderDirectionto a strict server-side whitelist (for example, mapping only known tokens likeASCandDESCfrom a fixed enumeration). - Avoiding direct string concatenation in SQL builders, even for seemingly harmless fields like column names or sort directions; instead, use query builder APIs or conditional branching to construct
ORDER BYclauses. - Centralizing query construction logic so that all dynamic SQL paths apply consistent validation and encoding rules to user input.
- Applying the principle of least privilege at the database layer so injected statements are constrained by limited permissions.
- Designing APIs so that clients cannot influence raw SQL syntax; instead, expose higher-level parameters that are resolved to safe server-side primitives.
How teams detect issues like this
Detection efforts can combine code-centric and behavior-centric approaches:
- Static analysis: Configure rules to flag dynamic SQL construction involving request parameters, particularly when values flow into
ORDER BY,WHERE, or other structural clauses without parameterization or whitelisting. - Code review: During manual reviews, examine utility classes like
Order2SQLObjand shared query builders, looking for string concatenation using HTTP parameters or request DTO fields. - Unit and integration tests: Add security-focused tests that send unexpected or malformed
orderDirectionvalues and verify that the application returns validation errors instead of propagating them to the database. - Runtime monitoring: Use database query logging and anomaly detection to spot queries containing user input in structural locations (e.g., unusual
ORDER BYfragments or timing patterns indicating time-based blind probing). - Policy enforcement: Integrate automated tools into CI/CD pipelines to enforce rules against raw SQL concatenation and require the use of approved query-building patterns.

