Malware on web servers and shared hosting often disguises itself as spoofed WordPress core files like wp-vcd, encoded eval/base64 function strings in index.php, or malicious mu-plugins that automatically regenerate after deletion. This article shares a technically standardized malware extraction workflow using Integrity Hash Checks, web shell scanning, and establishing thorough security hardening mechanisms for enterprise websites.
Never delete files directly without first performing a full, as-is backup of both the source code and the database. Any misstep can permanently break the website or trigger secondary backdoors that self-destruct data.
1. Signs Your WordPress Website Is Infected with Malware
A compromised website often exhibits the following unusual symptoms:
- Suspicious URL Redirection: Visitors coming from Google or mobile devices are redirected to gambling, betting, or phishing websites.
- Red Browser Warnings: Google Chrome or Google Search Console displays a warning: ‘Deceptive site ahead’.
- Rogue Admin Accounts Automatically Created: Unfamiliar administrator accounts with random email addresses appear in the user list, which were not created by anyone in your organization.
- CPU/RAM Resource Spikes: The server is constantly overloaded at 100% capacity due to malicious scripts running in the background to send spam emails (Spam Mail) or mine cryptocurrency.
2. Step 1: Isolate the Environment and Create an As-Is Snapshot
Before proceeding with dissection, immediately sever public access and create an audit trail using these 3 technical operations:
- Enable server maintenance mode: Configure a temporary 503 maintenance page to prevent malware from continuing to communicate with the attacker’s Command & Control (C&C) Server.
- Export a database backup: Run the command
wp db export backup_infected.sqlto preserve the exact state of the data for forensic analysis. - Compress the wp-content directory: Archive the entire
wp-content/directory into an independent compressed file to safeguard user upload files.
3. Step 2: Integrity Hash Check with WP-CLI
The fastest and most accurate way to clean malware is to verify all source code files against the official WordPress.org repository using WP-CLI:
The wp core verify-checksums command calculates the sha256 hash of each file on the server and compares it against WordPress.org servers. Any infected file, any modification by even a single character, or foreign files injected into the wp-admin or wp-includes directories will be instantly flagged.
4. Step 3: Scan and Extract Web Shells in the Uploads Directory
The wp-content/uploads/ directory should only contain media and document files (jpg, png, webp, pdf). Any file ending with .php, .phtml, or .ico that contains executable code is a Web Shell planted by hackers:
Once the list of malicious files has been identified, proceed to isolate and permanently remove them:
5. Step 4: Clean the Database and Revoke Admin Privileges
Many sophisticated malware strains do not reside in static files, but directly within the wp_options or wp_posts tables as obfuscated JavaScript scripts. You need to perform the following steps in the database:
- Check the
wp_userstable: Delete all unauthorized accounts with administrator privileges. - Check autoloaded keys in
wp_options: Scan theautoload = 'yes'field to find unusual values containing eval or base64 strings. - Regenerate all Security Salts in the
wp-config.phpfile to invalidate any remaining hacker sessions.
6. Step 5: Server Hardening and Locking Down Read-Only Mode
After completely cleaning the source code, the decisive step to prevent malware from returning is to harden the runtime environment:
7. Comparison of WordPress Malware Scanning Methods
Comparing the effectiveness of conventional plugin scanning versus technical hash verification workflows:
| Evaluation Criteria | Automated Scanning Plugins (Wordfence, Sucuri) | Technical Hash Verification Process |
|---|---|---|
| Zero-day malware detection capability | Low (relies solely on existing signature databases) | Absolute (detects any deviation from the original source code) |
| Server CPU/RAM resource consumption | Very high (often bottlenecks or crashes hosting during scans) | Extremely low (executed via CLI, taking only tens of seconds) |
| Handling mu-plugins and hidden files | Vulnerable to attackers disabling the scanner plugin itself | Completely isolated from the operating system server layer |
| Risk of malware reinfection | Frequent if even a single small backdoor is missed | 100% eradicated through clean source code replacement mechanism |
8. Frequently Asked Questions & Troubleshooting (FAQ)
A compilation of hands-on experience in troubleshooting hacked and malware-infected WordPress websites:
Read More: Explore Further Technical Categories on DevPixel VN

Chưa có bình luận nào. Hãy là người đầu tiên chia sẻ góc nhìn!