GHSA-526j-mv3p-f4vv

Suggest an improvement
Source
https://github.com/advisories/GHSA-526j-mv3p-f4vv
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/07/GHSA-526j-mv3p-f4vv/GHSA-526j-mv3p-f4vv.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-526j-mv3p-f4vv
Aliases
Related
Published
2025-07-24T14:19:17Z
Modified
2025-07-29T23:38:53Z
Severity
  • 8.9 (High) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P CVSS Calculator
Summary
eKuiper API endpoints handling SQL queries with user-controlled table names.
Details

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"
         }'
    
  3. Effect: Executes two SQL queries — the first selects data, the second drops the users table.
  4. 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

  • https://github.com/lf-edge/ekuiper/commit/72c4918744934deebf04e324ae66933ec089ebd3
Database specific
{
    "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"
}
References

Affected packages

Go / github.com/lf-edge/ekuiper/v2

Package

Name
github.com/lf-edge/ekuiper/v2
View open source insights on deps.dev
Purl
pkg:golang/github.com/lf-edge/ekuiper/v2

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.2.1

Go / github.com/lf-edge/ekuiper

Package

Name
github.com/lf-edge/ekuiper
View open source insights on deps.dev
Purl
pkg:golang/github.com/lf-edge/ekuiper

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Last affected
1.14.7