r/PHPhelp • u/grethrowaway21 • Mar 19 '25
Malicious file in php?
Hi ya'll-
Disclaimer: I am a noob. Sorry.
I have a WP blog site that was recently flagged for bandwidth usage, which was weird because it is literally just a blog site. Turns out there is a single malicious file: (/home/_________/public_html/wp-content/prayer_intentions.php).
How do I delete it? Where do I go to find it?
Do I need to scan my computer afterwards? Can anyone recommend a antivirus for these things?
1
Upvotes
8
u/MateusAzevedo Mar 19 '25 edited Mar 19 '25
As I said on r/PHP, it's advisable to search posts in this sub to find other topics related to hacked Wordpress sites to find more tips and info, not open a new thread...
As also said, it's better to redeploy your site from a known safe backup, you never know if that is the only malicious file. In case you don't have a backup, you can simply delete that file, but again, no guarantee that there isn't something else.
How to delete that file varies on each host. Some have an interface you can access the folders/files, some require FPT, or SSH.
2
u/suncoast_customs Mar 19 '25
Navigate to the directory using the file manager of your website host and delete the file at the path you listed.
Alternatively install a Wordpress security plugin. Also move this to /r/wordpress this is not a PHP topic.
1
u/_nlvsh Mar 20 '25
You could map your current “safe” directories and build a map. Then regularly you could run the check if there is any file that is not supposed to be there, especially and the root directory. Also checking files that contains write commands. I do this for years! Works by now and I have prevented and reverted problems in no time
0
u/Cpt_Mk47 Mar 19 '25
When you have a problem like this, the first thing to do is take a backup, then find the installation folder and follow the path of the file, delete it, then test your WP site if it's working fine or not, if it does take another backup and you are done