Wavlink AC3000 login.cgi set_sys_init() command injection vulnerabilities
The Wavlink AC3000 router's login.cgi binary fails to sanitise the restart_hour_value, restart_min_value, and restart_week_value POST parameters, allowing an unauthenticated attacker to inject arbitrary crontab entries and execute commands as root.
Originally disclosed on Cisco Talos
Multiple OS command injection vulnerabilities exist in the login.cgi setsysinit() functionality of Wavlink AC3000 M33A8.V5030.210505. A specially crafted HTTP request can lead to arbitrary code 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 set_sys_init function in login.cgi copies user-supplied POST parameters into a crontab entry without sanitisation, and that entry is later executed by the cron daemon.
Impact
An unauthenticated attacker could execute arbitrary commands as root on the router, leading to full compromise.
What the attacker needed
Network access to the router's web interface; no authentication required
The fix
The vendor has discontinued the product but patches are being worked on; the proper fix is to sanitise the input parameters before writing to the crontab.
How it was found
- Send an HTTP POST request to login.cgi with page=sysinit and a Content-Length less than 0x1f3.
- Include the restart_hour_value, restart_min_value, and restart_week_value parameters with values that form a valid crontab line containing injected commands.
- The set_sys_init function writes the combined string to the SCH_Reboot nvram variable.
- The schedule.sh init script reads SCH_Reboot and appends it to the adm2860 crontab file.
- The cron daemon executes the injected commands.
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 runs a small web server that lets you configure it. Some of the web pages call helper programs (CGI scripts) to apply settings. One of those programs, login.cgi, takes values from a form and writes them into a schedule file without checking them. Because the schedule file is later run as a list of timed commands, an attacker can put their own commands in the form and have the router run them, even without logging in.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.