好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

星网互动上传漏洞分析 - 网站安全 - 自学php

 

Author:狗一样的男人

upfile_flash. asp

 

########################################################################################################

 

<%

set upload=new upload_file

if upload.form("act")="uploadfile" then

filepath=trim(upload.form("filepath"))

filelx=trim(upload.form("filelx"))

 

i=0

for each formName in upload.File

set file=upload.File(formName)

 

fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.

if file.filesize<100 then

response.write "请先选择你要上传的文件! [ 重新上传]]

response.end

end if

if (filelx<>[swf]) and (filelx<>[jpg]) then

response.write [该文件类型不能上传! [ 重新上传]]

response.end

end if

if filelx=]swf] then

if fileext<>[swf] then

response.write [只能上传swf格式的Flash文件! [ 重新上传]]

response.end

end if

end if

if filelx=]jpg] then

if fileext<>[gif] and fileext<>[jpg] and fileext<>[swf] then

response.write [只能上传jpg/gif/swf格式的图片! [ 重新上传]]

response.end

end if

end if

if filelx=]swf] then

if file.filesize>(3000*1024) then

response.write [最大只能上传3M 的Flash文件! [ 重新上传]]

response.end

end if

end if

if filelx=]jpg] then

if file.filesize>(1000*1024) then

response.write [最大HdhCmsTest2cto测试数据只能上传1000K 的图片文件! [ 重新上传]]

response.end

end if

end if

 

randomize

ranNum=int(90000*rnd)+10000

filename=filepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&].]&fileExt

%>

<%

if file.FileSize>0 then ]如果FileSize > 0 说明有文件数据

‘file.SaveAs Server.mappath(filename) ]保存文件

file.SaveToFile Server.mappath(FileName)

‘response.write file.FileName&]  上传成功!  

]

‘response.write [新文件名:]&FileName&]

]

‘response.write [新文件名已复制到所需的位置,可关闭窗口!]

if filelx=]swf] then

response.write []

end if

response.write []

%>

<%

end if

set file=nothing

next

set upload=nothing

end if

%>

########################################################################################################

 

直接用明小子上传

HdhCmsTest2cto测试数据修复:

上面分析详细,自己修复吧

查看更多关于星网互动上传漏洞分析 - 网站安全 - 自学php的详细内容...

  阅读:41次