Home Experience & Tips Sharing Standard Post

Standard Post

How to Troubleshoot a Hacked WordPress Site? A Complete Record of Cleaning a Cross-Site Infection on the Same Server

Today Naiba took on a client's website antivirus task. Unlike the viruses encountered before, this virus was a cross-site infection from another website on the same server, so I'm writing an article to document it. Basic information of the infected client website. This time, the client who asked Naiba to handle the virus was a client who had Naiba build their website in 2021. The website is past its after-sales period, and the client had used EasyClaw to...

Updated on October 6, 2026 About 6 minutes read
WordPress 网站中毒怎么排查?一次同服务器跨站感染的完整查杀记录

Today Naiba took on a client's website antivirus task. Unlike the viruses encountered before, this virus was a cross-site infection from another website on the same server, so I'm writing an article to document it.

Basic information of the infected client website

This time, the client who asked Naiba to handle the virus was a client who had Naiba build their website in 2021. The website is past its after-sales period, and the client had used EasyClaw to redesign and operate the website, and had also let AI scan and handle it at a higher level than that year, butit was not completely resolved。

The server is a Hostinger VPS with Baota Panel installed. There are two websites in the panel.

Snipaste 2026 10 06 21 00

Entering the website list, I saw that another site in the list had daily traffic of over 800 MB, while the site I was asked to clean had daily traffic of only over 50 MB. Based on Naiba's years of experience, this site is most likely abnormal—either infected or under attack. However, it was not the target of this cleanup, so I only mentioned it to the client and did not deal with that site.

Virus investigation and removal

Entering the article directory of the website being investigated, I clearly saw a file that does not belong to WordPress: site.php

Opening the file, the code inside is clearly virus code, downloading malicious scripts from the site bujang.online.

Then continuing to check, I found a second virus file: wp-hide.php

Further investigating the plugin directory, I found a strange folder

0 insert-headers-and-footers

I don't know if the client used AI to process it and added a name to the folder; the correct one should be insert-headers-and-footers.

WordPress插件目录列表

The client„s website has a relatively large number of plugins, 42 in total. Manual verification would be troublesome, so Naiba directly asked AI to help compare all plugins against the official code, and finally found “disguised as a WordPress security module„wp-coreplugin„ and “plugins and theme files implanted with a POST execution backdoor„

After cleaning up these malicious codes, the virus on this site was completely removed.

Post-mortem analysis, discovering the root cause

Because it was the National Day holiday, after finishing the cleanup during the day, Naiba planned to analyze the logs at night to investigate how this site was compromised. However, AI analysis of the logs revealed that the above site was not the first to be compromised; it was the site that initially had daily traffic of over 800 MB.

TimeEventEvidence
August 28, 10:26Attacker IP187.14.109.121Successful login****.comBackendPOST /wp-login.phpReturned 302, then the admin homepage returned 200
10:26:46Open the plugin upload page in the admin panel/wp-admin/plugin-install.php?tab=uploadReturn 200
10:26:54Upload malicious pluginPOST /wp-admin/update.php?action=upload-plugin
10:27:03Directly execute the command backdoor in the malicious pluginRequestwp-cache-4ed103ec.php?...&c=echo+testReturn 200
10:43:22Execute using the backdoorpwdCommand executed successfully and returned the working directory
11:37:14The attacker successfully logged into the admin panel againLogin POST returned 302, admin panel returned 200
11:37:47Upload plugin via the admin panel againPOST ...action=upload-pluginReturn 200
11:39:32Activate WP File ManagerThe log clearly records the activationwp-file-manager/file_folder_manager.php
From 11:39:40Open the file manager and from/Browse the server from the root directoryThe target of File Managerl1_LwAfter decoding it is/
Around 11:43Write a backdoor to x-** via File ManagerThe same IP is continuously callingmk_file_folder_manager, and at the same time the x-teamrc backdoor file appears
11:43:43Test/site.phpThe attacking IP requests this file
11:43:53Test/aa.txtReturns 200, content length 4 bytes
11:45:15Test/wp-hide.phpBackdoor returns 401, requires authentication
11:45:25Successfully entered using backdoor usernameHTTP 200; log records Basic Auth username@FradaB321
11:47Create auxiliary backdoor in Revolution Slider directoryxmlc.php、includes/bs4.phpAll return 200
October 1Add POST execution backdoor in plugins and themescustom-1790893767 和 category-template-1790893826
October 4Add disguisedwp-corepersistent pluginImpersonate „WordPress Security Team“, load hidden remote JS
October 6 02:07Infected old copy was copied/restored to the production directoryFile modification time is still August, but inode creation time is October 6

Simply put, the attacker first gained administrator privileges on the site with higher daily traffic, then uploaded a malicious plugin through the backend plugin uploader.

Then the malicious plugin uploaded PHP files to infect another site.

Why does one site being infected cause another to be compromised too?

The root cause of one website being breached and then other servers on the same server also getting infected is that both sites run under the same Linux user group.

They are both www:www

linux用户组

After the attacker uploaded WP File Manager on another site, they configured the file manager root directory to the server's root directory, allowing access to files of other websites. (Note: Naiba has previously encountered a situation where a vulnerability in the WP File Manager plugin itself led to website infection, and now basically does not trust this plugin.)

Summary

When a website is injected with malware, the conventional troubleshooting directions are simple:

  1. Check the files and folders under the website root directory to see if there is any content that does not belong to WordPress.
  2. Check for files that should not exist, see if the code is garbled; if it is garbled, it is basically a malicious file.
  3. Check if there are any plugins you did not install; if there are, they are most likely malicious plugins.

In the vast majority of cases, deleting the infected files and reinstalling the WP core and plugins can resolve these virus infections, but if the database is infected, you also need to clean the malicious content in the database.

During the entire website virus scanning and removal process, what actually caused the target website to be infected was not a vulnerability in the website itself, but rather another website on the same server being compromised, and all websites using the same user and user group by default, which led to cross-site infection.

For this reason, it is recommended that friends who are concerned about such issues can perform the following operations:

  • Independent Linux user for each site;
  • Independent PHP-FPM Pool for each site;
  • wp-config.phpReadable only by the site's own user;
  • Independent database user;
  • Disable backend file editing;
  • Disable PHP in the upload directory;
  • Lock plugins, themes, and core outside of maintenance periods;
  • Administrators use independent strong passwords;
  • Regularly check administrator, application passwords, and component changes;
  • Retain sufficiently long access logs;
  • Regularly generate off-site backups and file baselines.

Of course, if you are usingWP Panel, then you don't need to worry about this issue. WP Panel by default has an independent Linux system user and user group for each site; an independent PHP-FPM Pool and socket for each site; the possibility of one website being compromised and infecting other websites on the same server is relatively low.

Rate this article post

What to do next

Recommended next step Switch from Baota Panel to WP Panel How to Migrate a WordPress Website from Baota Panel to WP Panel

Join the discussion

Welcome to share experiences, ask questions, or point out areas that need updating.