当前位置:网站首页>文件上传-upload-labs
文件上传-upload-labs
2022-07-02 06:28:00 【藤原千花的败北】
前言
upload-labs是一个使用php语言编写的,专门收集渗透测试和CTF中遇到的各种上传漏洞的靶场。旨在帮助大家对上传漏洞有一个全面的了解。目前一共20关,每一关都包含着不同上传方式
一、文件上传漏洞是什么?
Web应用程序中,文件上传是一种常见的功能需求,比如用户上传会员头像
如果不对上传的文件进行验证和过滤,攻击者可以通过上传恶意脚本,达到攻击的目的。
二、常见上传检测规则
- 客户端JS检测
- 服务端文件扩展名检测(黑白名单)
- 服务端MIME类型检测(HTTP首部行的content-type字段)
- 服务端目录路径检测(检测path参数中的敏感关键字)
- 服务器文件内容检测(检测文件内容)
三、绕过
靶机包含漏洞类型分类
如何判断上传漏洞类型
四、第1关
- 上传一个 1.php 文件,页面回显
- 即便不能通过上面的“很快回显”来判断,你也可以试着抓包,发现是抓不到的,查看页面的源代码会发现
function checkFile() {
var file = document.getElementsByName('upload_file')[0].value;
if (file == null || file == "") {
alert("请选择要上传的文件!");
return false;
}
//定义允许上传的文件类型
var allow_ext = ".jpg|.png|.gif";
//提取上传文件的类型
var ext_name = file.substring(file.lastIndexOf("."));
//判断上传文件类型是否允许上传
if (allow_ext.indexOf(ext_name + "|") == -1) {
var errMsg = "该文件不允许上传,请上传" + allow_ext + "类型的文件,当前文件类型为:" + ext_name;
alert(errMsg);
return false;
}
}
- 只要禁用脚本,即可绕过检测
五、第2关
- 上传一个非法文件,回显
- 能抓到数据包,说明为后端验证。将前面的1.php 更名为 1.png 上传成功。后端验证有多种验证方式,无源码的情况下,只能凭经验黑盒测试。
修改了MIME类型,即conten-type,上传成功,且成功解析
边栏推荐
- Installation and use of simple packaging tools
- STM32疑难杂症之ST-LINK Connection error INVALID ROM TABLE
- Li Kou daily one question brushing summary: binary tree chapter (continuous update)
- 力扣每日一题刷题总结:栈与队列篇(持续更新)
- Media query usage
- On the confrontation samples and their generation methods in deep learning
- How to wrap qstring strings
- Business architecture diagram
- Common shortcut keys of Jupiter notebook (you can also view it by pressing h in command mode)
- Generate database documents with one click, which can be called swagger in the database industry
猜你喜欢
C语言实现XML生成解析库(XML扩展)
DWORD ptr[]
Static library and dynamic library
When a custom exception encounters reflection
静态库和动态库
MySQL优化
STM32疑难杂症之ST-LINK Connection error INVALID ROM TABLE
Carsim-路面3D形状文件参数介绍
Carsim-问题Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?
Rotating linked list (illustration)
随机推荐
Sqlyog remote connection to MySQL database under centos7 system
Live broadcast platform development, flexible menu, and freely adjust the horizontal size of the menu bar
Using super ball embedding to enhance confrontation training
On the back door of deep learning model
常量指针和指针常量
高中数学必修一
Development of digital collection trading website development of metauniverse digital collection
Business architecture diagram
力扣方法总结:查找类
Smart agriculture solutions smart agriculture system development
Introduction to anti interception technology of wechat domain name
Opencv common method source link (continuous update)
多站点高可用部署
St-link connection error invalid ROM table of STM32 difficult and miscellaneous diseases
王-课外单词
Matlab-其它
Valin cable: BI application promotes enterprise digital transformation
旋转链表(图解说明)
Use of OpenCV 6.4 median filter
Force buckle method summary: sliding window