Summary
A critical command injection vulnerability in the DrayTek Vigor2960 CGI process allows attacker-controlled input in the sectiontype argument to influence operating-system command execution.
The issue may be exploitable remotely through the affected CGI endpoint, potentially allowing an attacker to execute commands with the privileges of the web or CGI service.
A critical command injection vulnerability in the DrayTek Vigor2960 CGI process allows attacker-controlled input in the sectiontype argument to influence operating-system command execution.
The issue may be exploitable remotely through the affected CGI endpoint, potentially allowing an attacker to execute commands with the privileges of the web or CGI service.
Affected context
The vulnerability occurs in the set_table function of /cgi-bin/mainfunction.cgi on affected Vigor2960 firmware. It becomes risky when the CGI process accepts externally supplied sectiontype data and incorporates it into command execution without adequately separating data from shell syntax. The affected product is also identified as end-of-support, which may limit the availability and scope of maintenance.
The vulnerability occurs in the set_table function of /cgi-bin/mainfunction.cgi on affected Vigor2960 firmware. It becomes risky when the CGI process accepts externally supplied sectiontype data and incorporates it into command execution without adequately separating data from shell syntax. The affected product is also identified as end-of-support, which may limit the availability and scope of maintenance.
Exploit preconditions
- Attack surface: The Vigor2960 CGI/web management interface
- Required access: Network reachability to the affected CGI endpoint; authentication requirements depend on deployment configuration and endpoint exposure
- Trigger point: Processing of the
sectiontypeargument by theset_tablefunction - Why exploitation is possible: Insufficient neutralization or separation of attacker-controlled input allows data to be interpreted as operating-system command syntax
- Attack surface: The Vigor2960 CGI/web management interface
- Required access: Network reachability to the affected CGI endpoint; authentication requirements depend on deployment configuration and endpoint exposure
- Trigger point: Processing of the
sectiontypeargument by theset_tablefunction - Why exploitation is possible: Insufficient neutralization or separation of attacker-controlled input allows data to be interpreted as operating-system command syntax
Why this happens
The underlying flaw is command injection caused by passing externally influenced input into an operating-system command construction or execution path without robust command separation and validation.
This maps primarily to CWE-77: Improper Neutralization of Special Elements used in a Command, with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component describing the broader injection pattern. Treating request parameters as trusted command fragments allows input to cross from the application layer into the system shell or command interpreter.
The underlying flaw is command injection caused by passing externally influenced input into an operating-system command construction or execution path without robust command separation and validation.
This maps primarily to CWE-77: Improper Neutralization of Special Elements used in a Command, with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component describing the broader injection pattern. Treating request parameters as trusted command fragments allows input to cross from the application layer into the system shell or command interpreter.
Potential impact
- An attacker may execute operating-system commands on the router
- The device may be compromised or have its configuration altered
- Network traffic could be redirected, monitored, or disrupted
- Credentials, secrets, or operational data could be exposed
- The compromised device could be used for lateral movement or further attacks
- Availability may be reduced through service disruption or destructive actions
- An attacker may execute operating-system commands on the router
- The device may be compromised or have its configuration altered
- Network traffic could be redirected, monitored, or disrupted
- Credentials, secrets, or operational data could be exposed
- The compromised device could be used for lateral movement or further attacks
- Availability may be reduced through service disruption or destructive actions
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from request-handling paths and reducing trust in CGI parameters.
Common defensive patterns include:
- Replacing shell commands with structured library or system APIs
- Allowing only explicitly defined
sectiontypevalues through strict allowlists - Separating command arguments from command selection rather than concatenating strings
- Applying context-appropriate escaping only as a secondary safeguard, not as the primary control
- Restricting management interfaces to trusted networks and limiting administrative exposure
- Running CGI services with the lowest practical operating-system privileges
- Applying compensating network controls when vendor maintenance is limited or unavailable
- Maintaining an inventory and retirement plan for unsupported network appliances
Mitigation generally focuses on removing shell interpretation from request-handling paths and reducing trust in CGI parameters.
Common defensive patterns include:
- Replacing shell commands with structured library or system APIs
- Allowing only explicitly defined
sectiontypevalues through strict allowlists - Separating command arguments from command selection rather than concatenating strings
- Applying context-appropriate escaping only as a secondary safeguard, not as the primary control
- Restricting management interfaces to trusted networks and limiting administrative exposure
- Running CGI services with the lowest practical operating-system privileges
- Applying compensating network controls when vendor maintenance is limited or unavailable
- Maintaining an inventory and retirement plan for unsupported network appliances
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules identifying shell execution, command construction, or subprocess calls that receive CGI parameters
- Code review checks for string concatenation or interpolation involving request data
- Tests that verify strict allowlisting and rejection of unexpected parameter values
- Web and device logs showing unusual requests to
/cgi-bin/mainfunction.cgi, especially abnormalsectiontypevalues or command-related metacharacters - Network monitoring for unexpected outbound connections or configuration changes from the appliance
- Policy enforcement that restricts management interfaces and flags unsupported firmware in asset inventories
Organizations can look for this class of issue through:
- Static analysis rules identifying shell execution, command construction, or subprocess calls that receive CGI parameters
- Code review checks for string concatenation or interpolation involving request data
- Tests that verify strict allowlisting and rejection of unexpected parameter values
- Web and device logs showing unusual requests to
/cgi-bin/mainfunction.cgi, especially abnormalsectiontypevalues or command-related metacharacters - Network monitoring for unexpected outbound connections or configuration changes from the appliance
- Policy enforcement that restricts management interfaces and flags unsupported firmware in asset inventories

