Control Web Panel backdoor hides commands from server logs
A Control Web Panel backdoor can execute attacker commands while keeping the related web requests out of server access logs, according to researchers at QiAnXin's XLab. Control Web Panel (CWP) is a free administration panel for Linux hosting servers. The malicious code is hidden inside cwpsrv, the web server software that receives requests for the panel. XLab named the backdoor, meaning a concealed way to regain access to a system, cwpdoor.
Installing cwpdoor requires root access, the highest level of control on a Linux server. This means an attacker must already have taken control before replacing cwpsrv. XLab said it does not yet know how attackers obtain that initial access, leaving the original point of compromise unresolved.
XLab captured the installer on June 29. It is a shell script, a file containing commands that Linux can run automatically, disguised as a version update. The script supports only cwpsrv 1.15.10 and 1.24.0. On September 30, someone in Brazil uploaded an archive containing the backdoor to VirusTotal, an online service that checks files with multiple security scanners. XLab said the upload indicates that real servers have been infected, but it did not provide a victim count.
The researchers' technical analysis found that the backdoor is not a separate program. It is a rebuilt copy of cwpsrv with additional malicious code. Most of the time it behaves like the legitimate web server. It activates when a request contains a valid timestamp and signature, a calculated value used to validate the request, inside custom headers whose names begin with X-Ngx-Integrity. Headers are extra information sent with a web request. If the checks succeed, cwpsrv runs the command included in that request.
This design also suppresses evidence in the access log, the normal record of requests received by a web server. During installation, the script replaces the legitimate cwpsrv file and resets its file dates to their previous values. As a result, the standard ls and stat commands make the altered file appear unchanged. When XLab checked the malicious file through VirusTotal, none of the 63 scanners detected it.
XLab recommends three checks for suspected servers. Administrators can run ss -axp | grep integrity and look for ngx_http_integrity_helper. This is the Unix socket, a private local communication channel between programs, used by the backdoor. They can also run ps aux | grep cwpsrv and check for unexpected helper processes launched by cwpsrv. Finally, running strings /usr/local/cwpsrv/bin/cwpsrv | grep X-Ngx-Integrity searches the program file for the backdoor's custom header names. In XLab's example, the socket check exposed the infection even though the server's open ports, the network connection points visible to administrators, appeared normal.
The researchers published the following evidence for security teams to search for. The MD5 value, a file fingerprint used to identify an exact file, for the installer cwpsrv_update.sh is e505d4ffa21cf494a5dc2d7c8f4f1236. The backdoored cwpsrv 1.15.10 has MD5 965aea67fb40de1bab5169ada993349f, while the altered cwpsrv 1.24.0 has MD5 d3f4e95113d49ab3991b45e457bda75b. The download server was 136.0.141[.]71, with files hosted at http://136.0.141[.]71/static/cwpsrv_update.sh, http://136.0.141[.]71/static/cwpsrv_1.15.10 and http://136.0.141[.]71/static/cwpsrv_1.24.0.
For an infected server, XLab first recommends restoring the original cwpsrv. The installer initially creates a copy under /usr/local/cwpsrv/bin with a name beginning cwpsrv.prev- and ending with a date and time. However, the researchers' account of the installation process says temporary files and the backup are deleted after a successful replacement, so that copy may no longer exist. Administrators should then upgrade to the latest version and confirm that ss -axp | grep integrity produces no result.
All control panel credentials, meaning the usernames and passwords used to sign in, should also be changed because cwpdoor can execute any command. XLab advises treating the entire server as compromised and examining it for additional threats rather than assuming that replacing cwpsrv completes the cleanup. For organisations that need support securing hosting operations more broadly, AEU-I provides security-first IT, infrastructure and consulting.
The archive uploaded from Brazil also contained Ebury, malware that has operated since at least 2009. Ebury is both an OpenSSH backdoor and a credential stealer. OpenSSH is software used for encrypted remote access to a server. XLab has not established a connection between Ebury and cwpdoor, and said separate attackers could have placed the two threats on the same machine.