当前位置:网站首页>文件上传-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,上传成功,且成功解析

边栏推荐
- One of the reasons for WCF update service reference error
- On the confrontation samples and their generation methods in deep learning
- Backup, recovery and repair of XFS file system
- OpenCV常用方法出处链接(持续更新)
- Find and rfind methods in string
- Use of opencv3 6.2 low pass filter
- Wang extracurricular words
- My VIM profile
- 常量指针和指针常量
- 程序猿学英语-指令式编程
猜你喜欢

Using transformer for object detection and semantic segmentation

Simply test the two different data transmission methods of content length and chunked

Jumping | Blue Bridge Cup

Carsim problem failed to start Solver: Path Id Obj (X) was set to y; Aucune valeur de correction de xxxxx?

Using super ball embedding to enhance confrontation training

SQLyog远程连接centos7系统下的MySQL数据库

C language implements XML generation and parsing library (XML extension)
![[dynamic planning] p4170: coloring (interval DP)](/img/52/76f8baebb19fe10db91c74fec9a697.jpg)
[dynamic planning] p4170: coloring (interval DP)

Linked list classic interview questions (reverse the linked list, middle node, penultimate node, merge and split the linked list, and delete duplicate nodes)

Don't know mock test yet? An article to familiarize you with mock
随机推荐
Global and Chinese markets of tilting feeders 2022-2028: Research Report on technology, participants, trends, market size and share
2022 Heilongjiang latest food safety administrator simulation exam questions and answers
Opencv common method source link (continuous update)
E-R draw clear content
A brief analysis of graph pooling
Global and Chinese market of wire loop, 2022-2028: Research Report on technology, participants, trends, market size and share
关于原型图的深入理解
Global and Chinese market of snow sweepers 2022-2028: Research Report on technology, participants, trends, market size and share
链表经典面试题(反转链表,中间节点,倒数第k个节点,合并分割链表,删除重复节点)
最长等比子序列
OpenCV关于x,y坐标容易混淆的心得
Use Matplotlib to draw a preliminary chart
Installation and use of simple packaging tools
力扣每日一题刷题总结:链表篇(持续更新)
力扣每日一题刷题总结:栈与队列篇(持续更新)
Organigramme des activités
Global and Chinese markets for magnetic resonance imaging (MRI) transmission 2022-2028: Research Report on technology, participants, trends, market size and share
樂理基礎(簡述)
Principes fondamentaux de la théorie musicale (brève introduction)
How to uninstall SQL Server cleanly