昨天,我发现我作为一名作家工作的一个网站(我没有管理员权限)在其所有页面中注入了恶意Javascript代码,如中所述this article by Luke Leal.
根据那篇文章,afake Wordpress plugin 该网站上安装了must以注入恶意代码。
我想提请您注意恶意代码的这一部分:
// This code is defined inside a PHP class...
function save_striplple_plugin() {
global $wp_list_table;
$h = array(\'wp-striplple/wp-striplple.php\');
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$h)) {
unset($wp_list_table->items[$key]);
}
}
}
public function striplple_start(){
...
add_action(\'pre_current_active_plugins\', [$this, \'save_striplple_plugin\']);
}
第二个方法将第一个方法添加到
pre_current_active_plugins
钩根据
official documentation, 该钩子在创建
installed plugins; 不是活动插件,而是已安装的插件。
第一个方法在调用该操作时运行,并且deletes the fake plugin from the list of installed plugins.
所以I wondered how could we create a list of the installed plugins on a website that could not be manipulated by an attacker. 从我的头顶上看,第一种方法是access the website 通过FTP 看看里面有什么/plugins
文件夹
然后I wondered if WP_CLI would show us this fake Wordpress plugin in the list of plugins. 虽然我以前使用过WP\\u CLI,但我不太了解它的内部流程以及它如何与Wordpress安装交互。
When WP_CLI runs Wordpress from the command line, are hooks called? Would a list of plugins generated with WP_CLI be manipulated by this fake Wordpress plugin?