動網論壇上傳檔案漏洞的原理以及攻擊的代碼實現

來源:互聯網
上載者:User
最近一段時間比較忙,沒什麼時間為組織做貢獻(實在是沒實力,呵呵).剛好前一段時間聽小*(*蛋兒的《目前流行的BBS安全性比較》一文請參閱:http://wvw.ttian.net/forum/viewtopic.php?id=269)說動網論壇出了一個上傳任意檔案的漏洞,當時沒怎麼明白.但是我看到最近NB論壇上全部都在討論有關這方面的問題,就研究了一下,發現這個漏洞確實存在,而且非常嚴重,用小*的話說是DVBBS7.0 SP2以下通殺.雖然有些人已經知道了攻擊方法,但是還是存在一些問題.下面我就動網的這個漏洞做一下講解.(不知道會不會被人罵,因為這個漏洞實在太大了).
我們先看一下動網論壇上傳檔案的相關代碼:
'===========無組件上傳(upload_0)====================
sub upload_0()
set upload=new UpFile_Class ''建立上傳對象
upload.GetDate (int(Forum_Setting(56))*1024) '取得上傳資料,不限大小
iCount=0
if upload.err > 0 then
select case upload.err
case 1
Response.Write "請先選擇你要上傳的檔案 [ <a href=# onclick=history.go(-1)>重新上傳</a> ]"
case 2
Response.Write "圖片大小超過了限制 "&Forum_Setting(56)&"K [ <a href=# onclick=history.go(-1)>重新上傳</a> ]"
end select
exit sub
else
formPath=upload.form("filepath")
''在目錄後加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
for each formName in upload.file ''列出所有上傳了的檔案
set file=upload.file(formName) ''產生一個檔案對象
if file.filesize<100 then
response.write "請先選擇你要上傳的圖片 [ <a href=# onclick=history.go(-1)>重新上傳</a> ]"
response.end
end if
fileExt=lcase(file.FileExt)
if CheckFileExt(fileEXT)=false then
response.write "檔案格式不正確 [ <a href=# onclick=history.go(-1)>重新上傳</a> ]"
response.end
end if
randomize
ranNum=int(90000*rnd)+10000
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.