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

边栏推荐
猜你喜欢

MySQL优化

2022 Heilongjiang latest construction eight members (materialman) simulated examination questions and answers

MySQL optimization

CarSim problem failed to start solver: path_ ID_ OBJ(X) was set to Y; no corresponding value of XXXXX?

On November 24, we celebrate the "full moon"

Data reverse attack under federated learning -- gradinversion

Don't know mock test yet? An article to familiarize you with mock

Rotating linked list (illustration)

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

Carsim 学习心得-粗略翻译1
随机推荐
关于原型图的深入理解
力扣每日一题刷题总结:字符串篇(持续更新)
Carsim-問題Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?
OpenCV常用方法出处链接(持续更新)
Static library and dynamic library
Real world anti sample attack against semantic segmentation
Backup, recovery and repair of XFS file system
Global and Chinese market of wire loop, 2022-2028: Research Report on technology, participants, trends, market size and share
Introduction to anti interception technology of wechat domain name
高中数学必修一
SQL操作数据库语法
How to build the alliance chain? How much is the development of the alliance chain
力扣每日一题刷题总结:栈与队列篇(持续更新)
双向链表的实现(双向链表与单向链表的简单区别联系和实现)
Use the kaggle training model and download your own training model
Introduction to parameters of CarSim pavement 3D shape file
Meta learning Brief
Linked list classic interview questions (reverse the linked list, middle node, penultimate node, merge and split the linked list, and delete duplicate nodes)
稀疏矩阵存储
MySQL优化