Summary
An authenticated command injection vulnerability in luci-app-https-dns-proxy allows users with the luci.https-dns-proxy ACL permission to inject shell metacharacters into the name parameter of a ubus RPC call.
When triggered, this can lead to arbitrary command execution as root on devices where the optional luci-app-https-dns-proxy package is installed and exposed.
Affected context
This vulnerability affects OpenWrt devices where:
- The optional
https-dns-proxybackend is installed, and - The
luci-app-https-dns-proxyLuCI web UI add-on is explicitly installed and enabled, and - Users or services are granted the
luci.https-dns-proxyACL permission to invoke ubus RPC methods.
Core OpenWrt firmware remains unaffected; only deployments that have opted in to this specific LuCI add-on and expose its RPC interface are impacted.
Exploit preconditions
- Attack surface: The ubus RPC endpoint for
luci.https-dns-proxy setInitAction, typically reachable via: - The LuCI web interface, or
- Programmatic ubus calls on the device.
- Required access: Valid authenticated session or credentials with the
luci.https-dns-proxyACL permission, or equivalent ubus access. - Trigger point: Supplying a crafted
nameparameter containing shell metacharacters to thesetInitActionubus method, which is subsequently passed into a shell context. - Why exploitation is possible: The
nameparameter is incorporated into a shell command without sufficient validation, sanitization, or safe argument handling, allowing shell metacharacters to alter command structure and inject attacker-controlled commands.
Why this happens
The underlying issue is an unsafe construction of shell commands using user-controlled data.
In the setInitAction function, the name parameter supplied via ubus is treated as a trusted string and concatenated or interpolated into a command that is executed by a shell.
Because there is no robust validation or encoding, shell metacharacters (such as ;, |, &&, redirections, or command substitutions) can break out of the intended argument context and introduce additional commands.
This behavior aligns with CWE-77: Command Injection, where untrusted input is used in OS command execution without proper neutralization, allowing attackers to influence the command interpreter.
Potential impact
- Arbitrary command execution as root on the affected OpenWrt device
- Installation of persistent malware or backdoors on the router
- Modification of DNS and network traffic routing, potentially enabling traffic interception or redirection
- Extraction of sensitive configuration data, including Wi‑Fi credentials, VPN keys, or other secrets stored on the device
- Use of the compromised device as a pivot for attacks against internal networks or as part of a botnet
General mitigation guidance
Mitigation typically focuses on removing direct shell interpretation of user-controlled values and reducing trust in RPC parameters:
- Refactor command execution paths to use APIs or system calls that accept structured arguments (e.g., exec-like functions) instead of passing concatenated strings to a shell.
- Treat all ubus and LuCI input as untrusted; apply strict allowlists on expected
namevalues and reject values that do not match known identifiers. - Normalize and validate parameters using conservative patterns (e.g., limiting to specific characters, lengths, or enumerated options) before they reach any command execution layer.
- Run web and RPC components with the least privilege necessary, avoiding root-level execution paths where feasible, and isolate sensitive operations in dedicated, constrained processes.
- Disable or restrict access to optional UI components like
luci-app-https-dns-proxywhen not needed, and minimize assignment of theluci.https-dns-proxyACL permission.
How teams detect issues like this
Organizations can detect and monitor for this class of issue using a combination of code-level and runtime approaches:
- Static analysis: Configure rules to flag direct use of shell command construction with user-controlled data (e.g., calls that invoke
/bin/sh,os.system,popen, or equivalent helpers in LuCI code paths where request parameters are involved). - Code review: During manual review, pay close attention to ubus handlers and LuCI controllers that execute system commands; ensure all parameters pass through validation or are mapped to controlled values rather than interpolated directly.
- Configuration and policy checks: Enforce development policies that prohibit executing shell commands with concatenated strings and require argument-based or API-based execution patterns.
- Runtime monitoring: Where feasible, log and monitor ubus RPC calls to
luci.https-dns-proxyand alert on unusualnamevalues containing shell metacharacters or unexpected patterns.

