Summary
A command injection flaw in luci-app-travelmate and the travelmate service allows configuration-level write access to be abused to execute arbitrary commands as root.
When an attacker can modify the travelmate UCI configuration, they can set the auto-login script fields to system binaries and arguments, leading to full device compromise during captive-portal handling.
Affected context
This vulnerability affects OpenWrt systems using the travelmate package and its LuCI front-end (luci-app-travelmate) to manage captive portal auto-login.
It is relevant where:
- LuCI/rpcd sessions are delegated the luci-app-travelmate write ACL, and
- Users or services with limited administrative rights are expected to only manage travelmate configuration via the UI, and
- The travelmate backend service runs as root and consumes UCI configuration for auto-login scripts without additional validation.
In such environments, the logical separation between configuration management and privileged execution is weaker than intended.
Exploit preconditions
- Attack surface: Local or remote LuCI/rpcd API exposed to authenticated users or delegated accounts.
- Required access: Ability to obtain a LuCI/rpcd session that holds the luci-app-travelmate write ACL, or otherwise modify the travelmate UCI configuration.
- Trigger point: Execution of the captive-portal auto-login path (
f_check()intravelmate-functions.sh), which readsscriptandscript_argsfrom UCI and runs them as root. - Why exploitation is possible: The backend trusts raw UCI configuration values and executes them without enforcing the frontend's path restriction or validating that the script target resides under
/etc/travelmate/*.login.
Why this happens
The core issue is a trust boundary violation between configuration-level access and privileged command execution.
The LuCI frontend attempts to constrain the auto-login "script picker" to /etc/travelmate/*.login, but this restriction is only enforced in the UI and not in the backend logic that actually runs as root.
The travelmate service reads script and script_args from UCI and directly passes them into an execution context, effectively allowing arbitrary command paths and arguments to be configured.
This pattern maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where unvalidated, attacker-controlled values are used to construct OS-level commands.
Potential impact
- Arbitrary command execution as root on the affected OpenWrt device.
- Full takeover of the router, including modification of firewall rules, DNS settings, and routing.
- Installation of persistent malware or backdoors on the device.
- Exfiltration or manipulation of network traffic passing through the router.
- Use of the compromised device as a pivot point to attack internal network systems.
General mitigation guidance
Effective mitigation focuses on hardening the boundary between configuration and execution and constraining what code the privileged service can run.
General defensive patterns include:
- Enforcing backend validation to only allow script paths within a strict allowlist (e.g., specific directories or named scripts).
- Avoiding direct execution of arbitrary paths from configuration; instead, map configuration options to a fixed set of predefined, vetted script identifiers.
- Treating all configuration values as untrusted input and sanitizing or normalizing them before use in command execution.
- Running privileged helpers with minimal required functionality and, where possible, dropping privileges before executing externally configurable scripts.
- Minimizing delegation of broad configuration write ACLs; apply principle of least privilege to LuCI/rpcd roles and limit who can modify auto-login parameters.
How teams detect issues like this
Detection efforts can focus on both code-level analysis and runtime monitoring:
- Static analysis: Flag code paths where UCI or other configuration values are passed into shell commands, process execution APIs, or shell script contexts without validation or allowlisting.
- Code review: Look for mismatches between frontend UI restrictions and backend enforcement, especially where UI constraints are assumed to be security controls.
- Configuration audits: Periodically inspect travelmate (and similar) configuration for suspicious script paths (e.g.,
/bin/sh, unusual binaries) or unexpected arguments. - Policy enforcement: Use CI/CD checks or pre-merge hooks to prevent introduction of new patterns that execute configuration-derived values directly.

