Summary
A path traversal vulnerability in the bmx7-info CGI script of OpenWrt luci-app-bmx7 allows attackers to read files outside the intended runtime directory by injecting directory traversal sequences in the query string.
When the CGI process has access to sensitive files, an unauthenticated remote attacker can leverage this flaw to disclose configuration, credential, or other sensitive data from the device.
Affected context
This vulnerability arises in OpenWrt deployments that expose the luci-app-bmx7 web interface and rely on the bmx7-info CGI script to serve runtime data from a configured runtimeDir.
The issue manifests when the script constructs filesystem paths directly from HTTP query parameters without normalizing or constraining them to the intended directory.
Systems where the CGI process user can read sensitive files (such as system configuration, keys, or logs) are at particular risk.
Exploit preconditions
- Attack surface: HTTP interface of the OpenWrt LuCI web UI exposing the bmx7-info CGI endpoint
- Required access: No authentication required; attacker only needs network reachability to the web interface
- Trigger point: Supplying crafted query parameters containing directory traversal sequences (e.g.,
../) to the bmx7-info CGI script - Why exploitation is possible: The script fails to validate or sanitize user-supplied path components and does not enforce that resolved paths remain inside the configured
runtimeDir
Why this happens
The root cause is an improper restriction of file path resolution, corresponding to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
The bmx7-info CGI script likely assembles file paths by concatenating a trusted base directory with untrusted user input, without normalizing the resulting path or checking that it remains within the intended runtimeDir.
This insecure pattern allows ../ sequences in the query string to escape the bounded directory and access arbitrary files readable by the CGI process.
Potential impact
- Unauthorized reading of system configuration files that may reveal network settings or internal topology
- Exposure of credentials, tokens, or keys stored in files accessible to the CGI process
- Leakage of log files that could aid in further attacks or reconnaissance
- Disclosure of application-specific data stored under or near the runtime directory
General mitigation guidance
Effective mitigation focuses on strictly constraining file access to the intended directory and treating all client-controlled path components as untrusted.
Common defensive patterns include:
- Normalizing and canonicalizing file paths before access, then verifying they remain within the allowed base directory
- Using whitelists or fixed filenames rather than directly mapping arbitrary query parameters to filesystem paths
- Employing filesystem-level controls, such as dedicated service users and restrictive permissions, to limit what the CGI process can read
- Designing CGI scripts to operate on identifiers or keys mapped to server-side paths, rather than exposing raw path semantics to clients
How teams detect issues like this
Detection can combine code-centric and operational approaches:
- Static analysis rules looking for use of user input in file path construction without canonicalization or boundary checks
- Code review checklists that flag any concatenation of HTTP parameters into filesystem paths in CGI or web handlers
- Runtime monitoring of web server logs for suspicious requests containing directory traversal patterns (e.g.,
../, URL-encoded traversal sequences) - Security testing and automated scanners that include path traversal payloads against CGI endpoints to detect unexpected file disclosures

