wordpress 有个命令 `wp core verify-checksums` 作用是检查,核心文件是否被修改。如果出现了WordPress installation doesn’t verify against checksums. 表明,核心文件已经被篡改,很有可能网站被黑了。
怎么解决
wp core download --skip-content --force
通过上面的命令可以, 重新安装核心文件(不会影响内容) 。
通过上面的命令,可以修复被删除,或者被修改的核心文件,但是有些新增加的文件,则不能被处理。比如黑客,在网站的根目录或者wp-content中增加了一个文件 login.php 这个文件是不能被处理的。
什么是核心文件

正常安装包里文件都是核心文件。包括 wp-content 下的默认的插件和模板。如果这些文件有变化,比如修改或者删除甚至在目录里增加文件,都是可通过 wp core verify-checksums 检查到的。
检查恶意文件(单独的恶意的php文件,不在wp-content 中的)
find . -not -path "./wp-content/*" -type f -name "*.php" -mtime +1
./flower.php
./wp-config.php
./thkhfc.php
工作原理: 因为刚刚执行行了 wp core download –skip-content –force ,所有的核心文件都已经被重置,时间也是当前的时间。就在整个网站查找一天前的php文件。发现了三个可疑的文件, 其中 wp-config.php 是正常文件,人工检查下内容,没有问题了,就是正常的文件。
需要特别注意的,就是 flower.php 和 thkhfc.php文件。人工检查下。比如这个

一看就有问题的文件,直接删除即可。
检查恶意文件(wp-content 中的插件和模板)
wp plugin verify-checksums --all
Warning: Couldn't fetch response from https://downloads.wordpress.org/plugin-checksums/Iitespeed-cache/1.0.json (HTTP code 404).
Warning: Could not retrieve the checksums for version 1.0 of plugin Iitespeed-cache, skipping.
Warning: Couldn't fetch response from https://downloads.wordpress.org/plugin-checksums/Iitespeed-cache/1.0.json (HTTP code 404).
Warning: Could not retrieve the checksums for version 1.0 of plugin Iitespeed-cache, skipping.
Success: Verified 4 of 6 plugins (2 skipped).
可以看到 Iitespeed-cache 这个插件校验失败,通常这些不是wordpress官方的插件,就可以可以的,人工检查下代码

很明显就是,恶意文件直接删除这个插件。
再次检查一下插件
wp plugin verify-checksums --all
Success: Verified 4 of 4 plugins.
发现四个插件都通过了检查。
恶意文件检查 模板
wp theme install twentytwentyfive --force
Installing Twenty Twenty-Five (1.2)
Downloading installation package from https://downloads.wordpress.org/theme/twentytwentyfive.1.2.zip...
Using cached file '/home/wsite/.wp-cli/cache/theme/twentytwentyfive-1.2.zip'...
Unpacking the package...
Installing the theme...
Removing the old version of the theme...
Theme updated successfully.
对于模板文件,重新安装即可。