Miggo Logo

CVE-2025-61141: sqls-server/sqls is vulnerable to command injection in the config command

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.78565%
Published
10/30/2025
Updated
10/31/2025
KEV Status
No
Technology
TechnologyGo

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
github.com/sqls-server/sqlsgo= 0.2.28

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability exists in the openEditor function in main.go. The function was responsible for opening the configuration file in an editor. The vulnerability was introduced by the use of exec.Command("sh", "-c", command), which passes the command to the shell for execution. The command variable was constructed by concatenating the editor program (from the EDITOR environment variable) and the file path. An attacker could set a malicious EDITOR environment variable (e.g., vim; id) to execute arbitrary commands. The patch fixes this by using exec.Command(program, args...), which executes the program directly without a shell, thus preventing command injection.

Vulnerable functions

openEditor
main.go
The `openEditor` function was vulnerable to command injection because it used `exec.Command("sh", "-c", ...)` to execute an external editor. The `program` argument, which is derived from the `EDITOR` environment variable, was concatenated with other arguments and passed to the shell. This allowed an attacker to control the `EDITOR` environment variable to execute arbitrary commands.

WAF Protection Rules

WAF Rule

sqls-s*rv*r/sqls *.*.** is vuln*r**l* to *omm*n* inj**tion in t** *on*i* *omm*n* ****us* t** op*n**itor *un*tion p*ss*s t** **ITOR *nvironm*nt v*ri**l* *n* *on*i* *il* p*t* to s* -* wit*out s*nitiz*tion, *llowin* *tt**k*rs to *x**ut* *r*itr*ry *omm*n

Reasoning

T** vuln*r**ility *xists in t** `op*n**itor` *un*tion in `m*in.*o`. T** *un*tion w*s r*sponsi*l* *or op*nin* t** *on*i*ur*tion *il* in *n **itor. T** vuln*r**ility w*s intro*u*** *y t** us* o* `*x**.*omm*n*("s*", "-*", *omm*n*)`, w*i** p*ss*s t** *om