Wavlink AC3000 qos.cgi qos_sta() command injection vulnerability
The Wavlink AC3000 router's qos.cgi binary writes user-supplied data from the time_control parameter into a file that is later read by a shell script and used to build crontab entries, allowing command injection. An authenticated attacker can execute arbitrary commands on the device.
Originally disclosed on Cisco Talos
A command execution vulnerability exists in the qos.cgi qossta() functionality of Wavlink AC3000 M33A8.V5030.210505. A specially crafted HTTP request can lead to arbitrary command execution.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The time_control POST parameter is written to a file without sanitisation, and that file is later parsed by a shell script that embeds the data into crontab lines, enabling command injection.
Impact
An authenticated attacker could execute arbitrary commands on the router with high privileges, potentially leading to full compromise of the device.
What the attacker needed
Valid session cookie (authenticated admin); network access to the router's web interface; device connected to WAN with NTP synchronised
The fix
The vendor has discontinued the product but patches are being worked on; the vulnerability should be fixed by sanitising the time_control input before writing it to the file and before using it in shell commands.
How it was found
- Log in to the router's web interface to obtain a valid session cookie.
- Send an HTTP POST request to qos.cgi with page=qos_sta and time_control_num set to a number greater than zero.
- Include a crafted time_control parameter containing shell metacharacters and commands.
- Wait for the scheduled script to run after NTP synchronisation, which writes the injected commands into the crontab.
- The injected commands are executed by the cron daemon.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This router has a web interface where an admin can set time controls for connected devices. The router saves the admin's input into a file, and later a script reads that file and uses it to schedule tasks. Because the input is not cleaned, an attacker who can log in can sneak in extra commands that the router will run with high privileges.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.