当前位置:网站首页>文件上传-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,上传成功,且成功解析
边栏推荐
- Linked list classic interview questions (reverse the linked list, middle node, penultimate node, merge and split the linked list, and delete duplicate nodes)
- Go functions make, slice, append
- My VIM profile
- Learn to write article format
- SQL server如何卸载干净
- 王-课外单词
- Opencv's experience of confusing X and Y coordinates
- CarSim problem failed to start solver: path_ ID_ OBJ(X) was set to Y; no corresponding value of XXXXX?
- W10 is upgraded to W11 system, but the screen is black, but the mouse and desktop shortcuts can be used. How to solve it
- 【无标题】
猜你喜欢
2022 Heilongjiang latest construction eight members (materialman) simulated examination questions and answers
STM32疑难杂症之ST-LINK Connection error INVALID ROM TABLE
SQLyog远程连接centos7系统下的MySQL数据库
Carsim problem failed to start Solver: Path Id Obj (X) was set to y; Aucune valeur de correction de xxxxx?
简易打包工具的安装与使用
【无标题】
Sequence problem for tqdm and print
Array and string processing, common status codes, differences between PHP and JS (JS)
Principes fondamentaux de la théorie musicale (brève introduction)
Real world anti sample attack against semantic segmentation
随机推荐
Don't know mock test yet? An article to familiarize you with mock
One of the reasons for WCF update service reference error
Erase method in string
OpenCV常用方法出处链接(持续更新)
双向链表的实现(双向链表与单向链表的简单区别联系和实现)
In depth understanding of prototype drawings
The best blog to explain the basics of compilation (share)
Li Kou daily one question brushing summary: binary tree chapter (continuous update)
Fundamentals of music theory (brief introduction)
笔记本电脑卡顿问题原因
Global and Chinese markets for Salmonella typhi nucleic acid detection kits 2022-2028: Research Report on technology, participants, trends, market size and share
Carsim-問題Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?
On the confrontation samples and their generation methods in deep learning
Constant pointer and pointer constant
链表经典面试题(反转链表,中间节点,倒数第k个节点,合并分割链表,删除重复节点)
STL速查手册
深入理解JVM
Chinese garbled code under vscade
Using super ball embedding to enhance confrontation training
Wang extracurricular words