最近一段時間比較忙,沒什麼時間為組織做貢獻(實在是沒實力,呵呵).剛好前一段時間聽小*(*蛋兒的《目前流行的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