Summary
DataEase versions 2.10.20 and below contain a SQL injection vulnerability in the dataset export API, where user-supplied filter expressions are translated into SQL without proper sanitization.
By crafting malicious values in the expressionTree parameter, an attacker can inject arbitrary SQL into export queries, potentially extracting or manipulating database data through blind SQL injection techniques.
Affected context
The vulnerability occurs in DataEase's dataset export functionality, specifically the POST /de2api/datasetTree/exportDataset endpoint.
Incoming expressionTree data is deserialized into a filter object and converted into SQL via WhereTree2Str.transFilterTrees, where like filter values are concatenated directly into query fragments.
This affects deployments where the export API is reachable (e.g., internal dashboards, shared analytics environments) and where user-controlled filter expressions are allowed to influence dataset exports without strict validation.
Exploit preconditions
- Attack surface: HTTP POST requests to
/de2api/datasetTree/exportDataset. - Required access: Ability to invoke the export API with a controllable
expressionTreeparameter (e.g., authenticated dashboard user, compromised account, or exposed endpoint). - Trigger point: Submission of a crafted filter expression whose
liketerm contains SQL meta-characters that break out of the intended string literal. - Why exploitation is possible: User-controlled filter values are directly concatenated into SQL fragments in
WhereTree2Str.transFilterTreeswithout parameterization or proper escaping, allowing the attacker to alter the structure of the resulting SQL query and perform blind SQL injection.
Why this happens
This issue is a classic example of CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection).
The application takes a structured filter object derived from expressionTree and builds SQL manually, concatenating like clause values directly into the query string.
Because these values are not passed through parameterized queries or robust escaping routines, the database interprets parts of the filter as executable SQL rather than data.
The bug is architectural: the SQL generation logic couples user-controlled input with raw query fragments instead of using a safe query-building abstraction or ORM parameter binding.
Potential impact
- Extraction of sensitive data from application tables via blind SQL injection (e.g., time-based inference).
- Enumeration of database schema, including table and column names.
- Possible modification or deletion of data, depending on the database user's privileges.
- Abuse of database-level functions to perform further reconnaissance within the database environment.
- Pivoting into other application functionality that relies on the same database account and permissions.
General mitigation guidance
Effective mitigation focuses on eliminating raw string concatenation in SQL construction and reducing trust in user-supplied filter expressions.
Recommended patterns include:
- Refactoring SQL generation to use parameterized queries or prepared statements for all user-controlled values, including
LIKEpatterns. - Introducing a safe query-building layer (ORM, query builder, or strict DSL) that never directly concatenates filters into SQL.
- Validating and normalizing filter structures and operators in
expressionTreeagainst an allowlist of supported operations and types before translation. - Limiting permissible characters and length in filter values where possible, especially for text-based search and
LIKEclauses. - Applying least-privilege to the database account used by DataEase, restricting it to only the necessary schemas and operations required for reporting.
- Centralizing SQL construction logic so security controls (parameterization, validation) are consistently applied rather than implemented ad hoc.
How teams detect issues like this
Detection typically combines code-level analysis with runtime monitoring.
Code and design inspection:
- Search for manual SQL string building in the codebase (e.g., concatenation in
WhereTree2Str.transFilterTreesand similar utilities). - Flag any use of user input (or deserialized objects like
expressionTree) that are inserted into SQL without parameters. - Use static analysis rules focused on CWE-89 that detect concatenation of request parameters, JSON fields, or expression trees into SQL strings.
- Review API endpoints that accept complex filter/ordering JSON and translate them into SQL to ensure these rely on parameterized query builders.
Runtime and operational monitoring:
- Enable database query logging and review for anomalous patterns, such as unexpected use of
sleep,benchmark, or heavy conditional expressions typical of time-based attacks. - Implement Web Application Firewall (WAF) rules tuned for SQL injection signatures on dataset export and filter-related endpoints.
- Correlate slow or delayed responses on export endpoints with suspicious query patterns to surface potential blind SQL injection attempts.

