Summary
A critical authorization and path-handling vulnerability in luci-app-lxc allows low-privileged authenticated LuCI users to reach container-management routes without consistent access checks. By influencing a container path, an attacker may escape the intended directory boundary and cause host-side scripts to execute with root privileges.
Affected context
The vulnerability occurs in OpenWrt systems running luci-app-lxc when LuCI backend routes process user-controlled container identifiers or filesystem paths. Risk is increased when ACL enforcement differs between frontend and backend routes and when host-side LXC hook scripts are executed with elevated privileges.
Exploit preconditions
- Attack surface: LuCI web interface and its backend container-management routes
- Required access: An authenticated LuCI account with low-level privileges
- Trigger point: Processing of the
lxc_namevalue by backend route and filesystem operations - Why exploitation is possible: Inconsistent ACL checks permit access to sensitive functionality, while insufficient path boundary enforcement may allow a supplied name to resolve outside the intended container directory
- Privilege boundary: Host-side LXC hook scripts may run with root privileges
Why this happens
The underlying issue combines inconsistent authorization enforcement with external control of a filesystem path. Backend routes do not uniformly apply the permissions expected by the LuCI interface, and the lxc_name value is used without sufficiently canonicalizing and constraining the resulting path to an approved container directory. This behavior maps primarily to CWE-73: External Control of File Name or Path, with the authorization inconsistency increasing the reachable impact.
Potential impact
- An attacker may access container-management operations beyond their assigned privileges
- Host-side files or scripts may be modified or selected outside the intended directory
- Root-level code execution on the OpenWrt host could occur
- Network configuration, credentials, and other hosted services may be exposed
- Compromise could enable persistence, lateral movement, or service disruption
General mitigation guidance
Mitigation generally focuses on enforcing authorization at every backend route and treating container identifiers as untrusted input.
Common defensive patterns include:
- Applying centralized, deny-by-default ACL checks to all container-management endpoints
- Resolving paths canonically and requiring them to remain within an approved base directory
- Using identifiers mapped to server-side records instead of accepting filesystem paths directly
- Rejecting traversal and ambiguous path representations before filesystem access
- Separating host-side hook execution from user-controlled data and minimizing hook privileges
- Running management components with the least privileges required
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis for filesystem operations using request parameters or unsanitized identifiers
- Code review checks confirming authorization on every backend route, independent of frontend visibility
- Tests involving canonicalization, encoded separators, alternate path representations, and directory-boundary enforcement
- Runtime logging and alerting for unauthorized route access, abnormal container names, and writes outside approved directories
- Policy enforcement requiring centralized authorization middleware and path-validation helpers
- Automated security review tools that flag external path control and missing access checks

