Summary
A SQL injection vulnerability in DataEase allows crafted table names submitted via the /de2api/datasource/update endpoint to be injected into a CREATE TABLE statement without sanitization or proper identifier escaping.
An authenticated attacker who can update datasources may execute arbitrary SQL, enabling database information disclosure and potentially broader compromise of the underlying database.
Affected context
The issue occurs in DataEase deployments that expose the /de2api/datasource/update API and allow authenticated users to modify or create datasource configurations.
During the datasource update flow, a user-provided deTableName is passed into DatasourceSyncManage.createEngineTable and interpolated directly into a CREATE TABLE SQL template.
In environments where database accounts used by DataEase have broad privileges, exploitation risk increases because injected SQL can affect more than the intended schema.
Exploit preconditions
- Attack surface: HTTP API endpoint
/de2api/datasource/update - Required access: Valid authenticated user with permissions to update datasource configurations
- Trigger point: Submission of a crafted datasource update payload where the
deTableNameparameter contains SQL meta-characters and injected statements - Why exploitation is possible: The
deTableNamevalue is concatenated into aCREATE TABLEstatement without parameterization, validation, or safe identifier quoting, allowing the attacker to break out of the intended identifier context and append arbitrary SQL.
Why this happens
This vulnerability is a classic instance of CWE-89: SQL Injection, where untrusted input is incorporated directly into SQL statements.
Instead of treating deTableName as an opaque identifier and safely quoting or parameterizing it, the implementation builds a dynamic CREATE TABLE statement via string concatenation.
Because no canonicalization, whitelist validation, or database-specific identifier escaping is applied, an attacker can inject SQL control characters (such as quote characters, delimiters, or statement terminators) into deTableName, causing the database to interpret part of the user input as executable SQL rather than as data.
Potential impact
- Extraction of database metadata such as table names, column types, and schema details
- Reading of sensitive business data from accessible tables via injected queries
- Modification or deletion of data within the privileges of the application's database account
- Creation or alteration of tables and other schema objects
- Potential pivot to broader database compromise if high-privilege accounts are used
General mitigation guidance
Effective mitigation centers on eliminating direct string concatenation for SQL construction and reducing trust in client-provided identifiers.
Recommended defensive patterns include:
- Using parameterized queries or prepared statements for all SQL components where supported, including identifiers when the database/driver permits.
- Applying strict server-side validation to identifiers such as table names (e.g., limiting to an approved character set, length, and format and rejecting any value that does not match a whitelist-style pattern).
- Employing database-specific safe identifier quoting utilities, rather than manual string concatenation, when dynamic identifiers are unavoidable.
- Segregating database privileges so that the application account used for datasource management has only the minimal schema and data permissions required.
- Centralizing SQL construction through well-reviewed helper functions or ORM layers, discouraging ad-hoc statement templates scattered across the codebase.
How teams detect issues like this
Organizations can look for similar issues using a combination of automated and manual techniques:
- Static analysis: Configure rules that flag raw SQL string concatenation using user-controlled variables (e.g.,
deTableName) and inspect areas where identifiers or clauses are built from request parameters. - Code review: During manual reviews, pay particular attention to API handlers for configuration or administrative endpoints and verify that all SQL is built via safe patterns (parameterization, validated identifiers, or ORM).
- Security testing: Use targeted input fuzzing and application security testing to submit specially crafted identifier values containing quotes, delimiters, and comment markers, observing for SQL errors or anomalous responses.
- Database monitoring: Enable query logging or use database activity monitoring tools to detect unexpected multi-statement executions, suspicious
CREATE TABLEor DDL operations, and patterns indicative of injection attempts.

