After the site is written to an abnormal PHP file, why does the official investigation sequence prioritize checking the runtime directory?
The official handling sequence is worth pondering: first upgrade to the fixed version, then delete the running directory, check the rewrite rules of pseudo-static, investigate abnormal PHP files, and explain that the problem is related to historical version vulnerabilities. The running directory is placed at a very early position, not by chance - it is both the most common point of injection and mostly renewable content. Deleting it will not damage the site data, and after cleaning, it can also be used as a reference for recurrence.
Order given in the announcement
The order itself has logic
| Steps | Purpose | Why is the order here |
|---|---|---|
| Upgrade to the fixed version | Close the exploited entry | If not upgraded first, it will be rewritten again after cleaning |
| Delete the running directory | Clean up common drop points | Mostly renewable content, deleting does not harm the data |
| Check rewrite rules | Check if it has been tampered with | The change in rules indicates that there is more than one place |
| Check for abnormal files | Find other landing points | Only after the first two steps are completed can a clean baseline be obtained |
Upgrade first and then talk about cleaning because cleaning when the entry is not closed is equal to doing nothing
Why should the running directory be cleared first
The running directory usually contains renewable content such as cache, temporary compilation products, etc., and the normal site can also be rebuilt. Therefore, it is low-risk and effective to clear it all at once. It is also the place where attackers like to drop files - the path is writable and the access is direct. Clearing here first not only maximizes the probability of removing the landed scripts but also leaves a 'clean baseline'. After that, any abnormality can be judged whether it recurs.
Why the static rule has been tampered with
The rewrite rule is one of the execution entry points, and being modified usually means that the attacker has left a backdoor or wants to ensure stable access to their files. When you see that the rule has been tampered with, you should not assume that only this place has been changed. You should expand the scope: other writable directories, scheduled tasks, upload directories should also be checked.
Why do we look at historical version vulnerabilities first
In the announcement, the problem is pointed out to be related to vulnerabilities in historical versions, which determines that the investigation cannot only focus on the current file. Most of the exploited entries are left by old versions, upgrading to the fixed version is to close the entry, deleting the running directory and investigating abnormal files is to clear the traces, both must be done. Only cleaning without upgrading, or only upgrading without investigating, will leave room for recurrence.
There are two things to confirm after cleaning up.
The backup time point must be earlier than the intrusion time; otherwise, recovering from the backup is the same as recovering the backdoor as well. This step relies on the data backup and recovery capability to ensure it. The second is to narrow down the writable surface: prevent the collection of interference codes, content verification, and sensitive word filtering to reduce the input surface that can be exploited. Combine with authentication and escaping class protection to prevent injection and cross-site scripting. Cleaning the files is stopping the bleeding, while closing the mouth is to prevent recurrence. Only after these two things are done, can we talk about putting the site back into normal operation and maintenance rhythm.
Common questions
Question: Is it okay to just delete files without upgrading?No. The entry is not closed, and the files will be rewritten again after deletion. Upgrading should be the first step, and cleaning up is the second step that follows.
Ask: Will deleting the runtime directory affect the data?Generally, it is renewable cache and temporary content, deleting it will not affect the site data; the text and attachments are stored elsewhere, not at this level.
Ask: How can you determine if the restored backup is clean?Confirm that the backup time is earlier than the earliest suspicious modification, check the rewrite rules and abnormal files immediately after recovery, do not go online directly.
Ask: Is one clear enough?It depends on whether the entrance is closed. After upgrading to the fixed version and narrowing the writable area, the recurrence probability will truly drop.