An open API service providing security vulnerability metadata for many open source software ecosystems.

GSA_kwCzR0hTQS01MjZqLW12M3AtZjR2ds4ABKdb

High CVSS: 8.9 EPSS: 0.00124% (0.32423 Percentile) EPSS:

eKuiper API endpoints handling SQL queries with user-controlled table names.

Affected Packages Affected Versions Fixed Versions
go:github.com/lf-edge/ekuiper/v2 < 2.2.1 2.2.1
0 Dependent packages
0 Dependent repositories

Affected Version Ranges

All affected versions

2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.2.0

All unaffected versions

Summary

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.

Details

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.

PoC

  1. Deploy eKuiper instance (default config is sufficient).
  2. Send a crafted request to the SQL query endpoint:
   curl -X POST http://localhost:9081/sql-query \
     -H "Content-Type: application/json" \
     -d '{
       "table": "sensors; DROP TABLE users; --",
       "operation": "getLast"
     }'
  1. Effect: Executes two SQL queries — the first selects data, the second drops the users table.
  2. Verify Result:
   sqlite3 etc/kuiper/data/kuiper.db ".tables"

Impact

CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Refferences

References: