Summary
A critical OS command injection vulnerability affects the D-Link DWR-M921 router through the folderpath argument handled by /boafrm/formDiskCreateShare. A remote attacker may be able to execute operating-system commands when the affected function processes attacker-controlled input without adequately separating data from shell commands.
Affected context
The vulnerability occurs in the router's disk-sharing functionality when the folderpath parameter is supplied to the affected form handler. Risk is present where the management interface or related service is remotely reachable and the parameter reaches command execution logic without sufficient validation or safe argument handling. The exact exposure depends on deployment configuration, network access controls, and whether authentication is required.
Exploit preconditions
- Attack surface: The router's web-based disk-sharing form handler at
/boafrm/formDiskCreateShare - Required access: Network access to the exposed management or service interface; authentication requirements depend on deployment configuration
- Trigger point: Processing of the
folderpathargument - Why exploitation is possible: Attacker-controlled input may be incorporated into an operating-system command without reliable separation between data and executable command syntax
Why this happens
The underlying bug is improper neutralization of special elements in externally controlled input used to construct or invoke an operating-system command. This behavior maps most specifically to CWE-78: Improper Neutralization of Special Elements used in an OS Command, with CWE-77: Improper Neutralization of Special Elements in Output Used by a Downstream Component representing the broader command-injection class. The insecure pattern occurs when a file path or similar value is treated as trusted command text rather than as a strictly validated argument passed through a non-shell API.
Potential impact
- An attacker may execute arbitrary commands with the privileges of the affected router service.
- The device could be compromised or rendered unavailable.
- Network traffic, configuration data, or connected storage may be exposed.
- The router could be used to access or attack other systems on reachable networks.
- Persistent tampering or unauthorized configuration changes could occur.
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from file-management operations and reducing trust in request parameters.
Common defensive patterns include:
- Use direct, non-shell process and filesystem APIs with fixed operation mappings.
- Treat path values as data, apply strict allowlisting, and constrain them to approved directories.
- Reject unexpected characters, encodings, path traversal components, and ambiguous path representations.
- Apply authentication, authorization, and network segmentation to administrative interfaces.
- Run the affected service with the minimum filesystem and process privileges required.
- Use secure-by-default management exposure settings and restrict administrative access to trusted networks.
- Add regression tests covering command metacharacters, malformed paths, and alternate encodings.
How teams detect issues like this
Detection can combine source review, runtime monitoring, and administrative policy checks.
- Static analysis can flag request parameters concatenated into shell commands or passed to shell-evaluating APIs.
- Code review should examine handlers that transform web input into filesystem paths, command-line arguments, or scripts.
- Runtime monitoring may identify unexpected child-process creation, unusual command execution, or outbound connections from the router service.
- Web and device logs can be reviewed for anomalous requests to the disk-sharing endpoint and unusual
folderpathvalues. - Policy enforcement can restrict management interfaces to authorized networks and alert on configuration changes or service behavior outside approved baselines.
Automated security review tools may help identify command-construction patterns, but findings should be validated against the actual execution path.

