1. Home
  2. Network Vulnerabilities
  3. How to remediate – ZXShell Malware Services Detection

How to remediate – ZXShell Malware Services Detection

1. Introduction

ZXShell is a remote access trojan backdoor used to gain persistent control of compromised systems. This poses a significant risk to business confidentiality, integrity and availability as attackers can steal data, modify system settings, and disrupt services. Systems commonly affected include those running web servers or other internet-facing applications. Impact on confidentiality, integrity, and availability is likely to be high if exploited successfully.

2. Technical Explanation

  • Root cause: Lack of robust input validation and insufficient access control on internet-facing services.
  • Exploit mechanism: An attacker uploads malicious files to a compromised server and executes them using HTTP requests. For example, an attacker could upload a PHP script containing ZXShell code to a web directory with write permissions.
  • Scope: Web servers running PHP, potentially other scripting languages depending on the variant of ZXShell used.

3. Detection and Assessment

Confirming a ZXShell infection requires checking for specific files and network connections. A quick check involves looking for suspicious processes or files. Thorough assessment includes scanning with updated threat intelligence feeds.

  • Quick checks: Use the `ps` command to look for unusual processes running under web server user accounts. Check web server directories for recently modified files.
  • Scanning: Nessus plugin ID 12727114 can detect ZXShell HTTP and Command and Control servers. This is an example only, other scanners may also provide detection capabilities.
  • Logs and evidence: Examine web server access logs for unusual requests or file uploads. Look for connections to known malicious IP addresses in firewall logs. Event IDs related to process creation or network connections should be investigated.
ps aux | grep -i zxshell

4. Solution / Remediation Steps

Removing the infection is the primary solution. This involves identifying and deleting malicious files, stopping associated processes, and restoring compromised systems from backups if necessary.

4.1 Preparation

  • Ensure you have access to clean installation media or a reliable backup image for restoration purposes. A roll back plan involves restoring the stopped web server service from the pre-infection backup.
  • A change window may be required, depending on the criticality of the affected systems and potential downtime. Approval from IT management is recommended.

4.2 Implementation

  1. Step 1: Stop the web server service (e.g., Apache, Nginx).
  2. Step 2: Delete any files associated with ZXShell from all web server directories. This includes PHP scripts, executables, and configuration files.
  3. Step 3: Scan the entire system for remaining malicious files using an updated antivirus or anti-malware solution.

4.3 Config or Code Example

Before

After

4.4 Security Practices Relevant to This Vulnerability

Several security practices can help prevent ZXShell infections. These include least privilege, input validation, and regular patching.

  • Practice 1: Implement the principle of least privilege by granting web server user accounts only the necessary permissions. This limits the impact if an attacker gains access.
  • Practice 2: Enforce strict input validation on all user-supplied data to prevent malicious code injection.

4.5 Automation (Optional)

# Example PowerShell script to remove files (use with caution!)
# Get-ChildItem -Path "C:inetpubwwwroot" -Filter "*.php" -Recurse | Where-Object {$_.Name -match "zxshell"} | Remove-Item -Force

5. Verification / Validation

Confirming the fix involves verifying that malicious files have been removed and re-scanning for any remaining traces of ZXShell. A smoke test should confirm normal web server functionality.

  • Post-fix check: Run `ps aux | grep -i zxshell` again; no output should be returned.
  • Re-test: Re-run the Nessus scan (plugin ID 12727114); it should not detect ZXShell.
  • Smoke test: Verify that basic web server functionality is working as expected, such as accessing a standard webpage or submitting a form.
  • Monitoring: Monitor web server access logs for any unusual activity or file uploads. A simple log query could look for failed requests to known malicious URLs.
ps aux | grep -i zxshell

6. Preventive Measures and Monitoring

Updating security baselines, implementing CI/CD checks, and maintaining a robust patch process are essential preventive measures. For example, regularly update web server software to address known vulnerabilities.

  • Baselines: Update your security baseline or policy to include restrictions on file uploads and execution permissions in web server directories.
  • Asset and patch process: Implement a regular patch cycle for all web servers and related software, ensuring timely application of security updates.

7. Risks, Side Effects, and Roll Back

Removing files may disrupt legitimate web server functionality if incorrectly identified. Service downtime is possible during the remediation process. A roll back involves restoring the stopped web server service from a pre-infection backup.

  • Risk or side effect 2: Service downtime during the remediation process. Mitigation: Schedule maintenance windows and communicate potential disruptions to users.

8. References and Resources

Updated on October 26, 2025

Was this article helpful?

Related Articles