发布日期:2011-01.29
发布作者:xiaokis
漏洞类型:文件上传
漏洞描述:
文件:sub_upload.asp
01 <!--#include file="UPLOAD.INC"-->
02 <%if session("admin_name")="" and Session("ME_name")="" then%>
03 <style type="text/css">
04 <style type="text/css">
05 <!--
06 body,td,th {
07 font-size: 12px;
08 }
09 -->
10 </style>
11 <link href="css/01.css" rel="stylesheet" type="text/css">
12 <style type="text/css">
13 <!--
14 body {
15 background-color: #333333;
16 }
17 -->
18 </style>
19 对不起,您不是会员,不会进行此项操作!
20 <%else%>
21 <%
22 dim arr(3)
23 dim upload,file,formName,formPath,iCount,filename,fileExt,i
24 set upload=new upload_5xSoft ''建立上传对象
25
26 formPath="" '图片存放的路径:product目录下的uploadimages文件夹 ''在目录后加(/)
27
28 ''列出所有上传了的文件
29 for each formName in upload.file
30 set file=upload.file(formName)
31 if file.filesize>0 then
32 if file.filesize>10000000 then
33 response.write "<font size=2>图片大小超小了限制[<a href=#
34
35 οnclick=history.go(-1)>重新上传</a>]</font>"
36 response.end
37 end if
38 fileExt=lcase(right(file.filename,4))
39 if fileExt<>".jpg" then
40 response.write "<font size=2>文件格式限制[<a href=# οnclick=history.go(-1)>请重新上
41
42 传</a>]</font>"
43 response.end
44 end if
45 end if
46
47 filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)
48
49 &file.FileName
50
51 if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
52 file.SaveAs Server.mappath(formpath&filename) ''保存文件
53 'response.write file.FilePath&file.FileName&"("&file.FileSize&") =>
54
55 "&formPath&File.FileName&"上传成功"
56 response.write "上传成功 <a href=# οnclick=history.go(-1)>请返回</a>"
57
58 end if
59 set file=nothing
60 next
61 set upload=nothing
62 Response.Write "<script>parent.add.picUrl.value='"&FileName&"'</script>"
63 %>
64 <%end if%>
文件上传是自定义名字的,所以利用IIS 解析漏洞。
利用方法:首先注册用户,然后填写黄页,上传x.asp;.jpg
上传页面upImgFile/upload.htm
提交页面:upImgFile/sub_upload.asp
文件上传后存在目录下:upImgFile
漏洞证明:http://www.xxx.com/upImgFile/2011129204147jiami.asp;.jpg
修复方案:临时限制上传目录脚本执行或者加强文件过滤。