记录黑客技术中优秀的内容, 传播黑客文化,分享黑客技术精华

简单分析一个上传函数 上传漏洞突破

2014-03-04 21:30

 


Function fnUploadImg(ByVal upFile As HttpPostedFile, ByVal uploadPath As String) As String
Dim result As String = ""
Dim intImgSize As Int32
intImgSize = upFile.ContentLength
If intImgSize <> 0 Then
If intImgSize > 500000 Then
result = "图片太大"
Return result
Exit Function
End If
Dim strImgType As String = upFile.ContentType
'只接受.jpg格式的图片
Dim filesplit() As String = Split(strImgType, "/")
strImgType = filesplit(filesplit.Length - 1)
If strImgType = "jpg" Or strImgType = "jpeg" Then
Else
result = "图片格式错误"
Return result
Exit Function
End If
filesplit = Split(upFile.FileName, "\")
Dim filename As String = filesplit(filesplit.Length - 1)
upFile.SaveAs(Server.MapPath("upload\location\" & uploadPath) & "\" & filename)
Dim imgpath As String = "upload/location/" & uploadPath & "/" & filename
result = imgpath
Return result
End If
End Function




突破方法:上传任意文件,抓包修改Content-Type为:image/jpeg
知识来源: www.2cto.com/Article/201403/283124.html

阅读:77175 | 评论:0 | 标签:漏洞

想收藏或者和大家分享这篇好文章→复制链接地址

“简单分析一个上传函数 上传漏洞突破”共有0条留言

发表评论

姓名:

邮箱:

网址:

验证码:

公告

关注公众号hackdig,学习最新黑客技术

推广

工具

标签云