Wavlink AC3000 nas.cgi set_smb_cfg() Configuration Control Vulnerability
The router's nas.cgi set_smb_cfg() function writes user-supplied SMB configuration values directly into /etc/smb.conf without filtering, allowing newline injection. An authenticated attacker can inject a 'root preexec' line to execute arbitrary shell commands when the Samba server is accessed.
Originally disclosed on Cisco Talos
An external config control vulnerability exists in the nas.cgi setsmbcfg() 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 set_smb_cfg() function passes user-controlled parameters to nvram and then to a shell script that writes them into /etc/smb.conf without sanitising newline characters, enabling configuration injection.
Impact
An authenticated attacker could execute arbitrary commands as root, leading to full compromise of the router.
What the attacker needed
Valid session cookie (authenticated user); network access to the router's web interface
The fix
The vendor has discontinued the product but patches are being worked on; the proper fix is to sanitise or reject newline characters in the smb_netbios parameter before writing to the configuration file.
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=smb and include smb_enabled=1 and a crafted smb_netbios value containing newlines and a root preexec line.
- The router writes the injected configuration into /etc/smb.conf.
- Connect to the Samba service to trigger the root preexec command.
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 admin page that lets you change SMB (file sharing) settings. The page takes your input and puts it straight into a configuration file without cleaning it. Because you can include line breaks, you can add extra settings that tell the router to run commands, giving an attacker 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.