Summary
A command injection vulnerability in the DrayTek Vigor2960 affects the set_table function in /cgi-bin/mainfunction.cgi. A remote attacker who can supply manipulated jsondata may be able to cause commands to run on the device; public exploit information has been disclosed.
Affected context
The issue is reported in DrayTek Vigor2960 firmware 1.5.1.6 and affects the set_table function in /cgi-bin/mainfunction.cgi. It becomes a risk when the relevant CGI endpoint is reachable and attacker-controlled jsondata is processed in a way that allows command syntax to affect command execution. The description does not specify whether authentication is required.
Exploit preconditions
- Attack surface: The device's CGI interface, if reachable by the attacker
- Required access: The ability to submit or influence the
jsondataargument; authentication requirements are not specified - Trigger point: Processing of
jsondataby theset_tablefunction - Why exploitation is possible: Input may reach command execution without adequate separation or neutralization of command syntax
Why this happens
The reported behavior is consistent with command injection: data supplied through an application interface can influence commands interpreted by the operating system. This maps primarily to CWE-77: Improper Neutralization of Special Elements used in a Command. CWE-74 is also associated with the issue and describes the broader class of improper neutralization of special elements in output used by another component.
Potential impact
- An attacker may be able to execute commands on the device
- Device settings or data could be altered
- The device could be disrupted or taken over
- A compromised device could potentially be used as a foothold for further attacks
General mitigation guidance
Mitigations generally focus on preventing untrusted input from influencing operating-system commands.
- Prefer APIs that invoke required functionality without constructing shell commands.
- Where command execution is unavoidable, use fixed command structures and pass validated arguments separately.
- Apply strict allowlist validation to values received through
jsondata. - Reduce exposure of management interfaces and limit access to trusted networks and users.
- Run device components with the least privilege needed and monitor for unexpected command execution.
How teams detect issues like this
- Review code paths from CGI parameters, especially
jsondata, into shell or process-execution APIs. - Use static analysis to flag command construction from externally controlled input and unsafe shell invocation.
- Review whether inputs are validated against expected types, formats, and allowlists before use.
- Apply access policies to restrict reachability of device management interfaces, and monitor available logs for unusual requests or command activity.
- Automated code review tools may help identify risky input-to-command flows.

