表題のような問題が発生し、結果的に改修できたっぽいのでメモがてら
困ってる人へ共有
レンタルサーバ
Xサーバ
Wordpressバージョン
4.8.3
症状
ある日突然、管理画面のダッシュボード(ログイン直後の画面)がエラーとなり
ググる限りどこかの海外の方の記事がいくつか引っかかったものの
解決策らしきものが見つけられなかった
https://wordpress.org/support/topic/wp-admin-index-php-keeps-changing/
なので、サーバ上のwordpressフォルダと、ローカルにバックアップしておいたものの差分を取ると
以下のような差分が確認できた。
index.php //差がある
wp-load.php //差がある
wp-content/.htaccess //存在しなかったファイル
wp-content/index.php //差
wp-content/plugins/index.php //差
wp-content/plugins/.htaccess //存在しなかったファイル
wp-content/languages/admin-en_GB.mo //差
wp-content/languages/admin-en_GB.po //差
wp-content/languages/admin-network-en_GB.mo //差
wp-content/languages/admin-network-en_GB.po //差
wp-content/languages/en_GB.mo //差
wp-content/languages/en_GB.po //差
wp-content/uploads/index.php //存在しなかったファイル
wp-content/themes/index.php //差
wp-content/themes/[テーマフォルダ]/.htaccess //存在しなかったファイル
wp-content/themes/[テーマフォルダ]/404.php //差
wp-admin/includes/images.php //存在しなかったファイル
wp-admin/includes/index.php //存在しなかったファイル
wp-admin/maint/index.php //存在しなかったファイル
wp-admin/index.php //差
wp-admin/wp-load.php //存在しなかったファイル
wp-admin/ms-menu.php //存在しなかったファイル
wp-include/js/utilitis.js //c
wp-include/js/cachexxxxxxxxxxxxxxxxxxx //存在しなかったファイル
wp-include/pomo/index.php //存在しなかったファイル
wp-include/pomo/so.php //存在しなかったファイル
wp-include/Requests/IPconfig.ini //存在しなかったファイル
wp-include/Requests/cachexxxxxxxxxxxxxxxxxxx //存在しなかったファイル
wp-include/Text/index.php //存在しなかったファイル
wp-include/Text/Tiff.php //存在しなかったファイル
wp-include/.htaccess //存在しなかったファイル
wp-include/class.wp-date.php //存在しなかったファイル
wp-include/functions.wp-date.php //存在しなかったファイル
wp-include/generalwtemplate.php //存在しなかったファイル
wp-include/template.php //差
上記、「差」と記載したものには怪しい記述などが追加されており、
「存在しなかったファイル」は、バックアップ時には無かったファイル
とくに
最上階層のindex.phpとwp-load.phpに変なファイルの読み込みが追記されているようで
@include( dirname( __FILE__ ) . '/wp-includes/js/utilities.js' );
// Network host configuration. Not recommended edit this code!
@include ( ABSPATH . WPINC . '/Requests/IPconfig.ini' );
とりあえず、このへんの読み込み元、読み込み先のファイルを削除し、
問題の管理画面ダッシュボードの該当ファイルである
wp-admin/index.phpをバックアップ時のもので上書きすると
一時的にダッシュボードのエラーがなくなり、画面が表示された。が、、、
サイトページを表示させ、もう一度、管理画面に戻ると
またエラーになる。
(削除したはずのファイルも、また生成されている)
なので、
上記差分のあるファイル群全てを、削除・上書きすることにした
[差があるファイル]
→バックアップ時のファイルを上書き
[存在しなかったファイル]
→削除
すると、サイトを表示させてもダッシュボードがまたエラーになることはなかったので
wordpressを急いで4.9.1へアップグレード
まだ、再発しないか様子を見ている状況なので、なんとも言えないが
同様の症状で困ってる方のお役になれば幸いです。
最近、攻撃されたらしきwordperssの改修を何度か対応しましたが
「メールサーバを勝手に使われて、凄い数のスパムメールを送信する」というものだったが
今回の症状は初めてでした。
(内部的に何をされていたのか詳しいことはわかりませんが)