Summary
An OS command injection vulnerability in luci-app-https-dns-proxy allows authenticated users to influence shell commands through the name parameter. The issue becomes risky when that parameter reaches shell execution without strict validation or safe argument handling.
Affected context
The vulnerability occurs in the setInitAction function exposed through
/usr/libexec/rpcd/luci.https-dns-proxy in affected OpenWrt deployments.
Exploitation depends on an authenticated user being able to invoke the
relevant RPC action and supply a crafted name parameter that is processed
by a shell command.
Exploit preconditions
- Attack surface: The LuCI RPC interface provided by the HTTPS DNS proxy application
- Required access: Authentication and permission to invoke the affected action
- Trigger point: Processing of the
nameparameter bysetInitAction - Why exploitation is possible: User-controlled input can reach shell command construction without sufficient metacharacter filtering, escaping, or safe argument binding
Why this happens
The underlying bug is shell command construction from user-controlled input.
When a parameter is concatenated into a shell command, shell metacharacters
can alter the intended command structure and cause additional commands to be
interpreted. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly called OS command injection.
Potential impact
- An attacker may execute arbitrary commands with the privileges of the affected service
- The attacker could alter DNS proxy configuration or service state
- Sensitive configuration data may be accessed or modified
- The device could be used for network disruption, persistence, or lateral movement
- System integrity and availability may be affected
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from the
operation and reducing trust in RPC parameters.
Common defensive patterns include:
- Replacing shell command construction with direct system calls or APIs that pass arguments without a shell
- Applying strict allowlist validation to values such as service or configuration names
- Using carefully designed argument-escaping mechanisms when shell execution cannot be avoided
- Enforcing least-privilege permissions for the RPC handler and its service account
- Restricting authenticated users to only the RPC actions they require
- Treating all RPC and LuCI input as untrusted, including input from otherwise authorized users
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules that flag string concatenation or interpolation into shell execution APIs
- Code review checks for RPC parameters passed to
system,popen, shell wrappers, or equivalent functions - Tests using metacharacter-containing input to verify that values remain data rather than executable syntax
- Runtime policy controls that restrict command execution and monitor unexpected process creation by RPC services
- Automated security review tools that identify command construction from externally influenced values

