Wavlink AC3000 nas.cgi remove_dir() Command Injection Vulnerability
The nas.cgi binary on the Wavlink AC3000 router passes the user-supplied dir_path parameter directly into a system command without sanitisation. An authenticated attacker can inject shell commands and execute arbitrary code on the device.
Originally disclosed on Cisco Talos
An os command injection vulnerability exists in the nas.cgi removedir() 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 remove_dir function calls do_system with a format string that includes the unsanitised dir_path parameter, allowing command injection.
Impact
An authenticated attacker can execute arbitrary commands on the router, potentially leading to full compromise of the device.
What the attacker needed
Valid session cookie (authenticated user); network access to the router's web interface
How it was found
- Log in to the router's web interface to obtain a valid session cookie.
- Send an HTTP POST request to nas.cgi with page=rmdir and a crafted dir_path parameter containing shell metacharacters.
- The router executes the injected command with the privileges of the nas.cgi process.
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 you can manage files. One of the actions, removing a directory, takes a folder name from the user and puts it into a system command without checking it. By putting special characters in the folder name, an attacker can make the router run their own commands, giving them full control of the device.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.