Web安全—information_schema數(shù)據(jù)庫
前言:在SQL注入中,information_schema數(shù)據(jù)庫中包含的信息特別重要,通過這個表我們可以去獲取到存在SQL注入網(wǎng)站的表,列,等信息,其危害不言而喻。
一:information_schema數(shù)據(jù)庫
基礎:information_schema是一個存放了當前數(shù)據(jù)庫管理系統(tǒng)中所有數(shù)據(jù)庫信息的一個數(shù)據(jù)庫,數(shù)據(jù)庫只能進行讀取,不支持修改(增,刪,更新)
mysql5.0以下:多用戶單操作,不存在information_schema數(shù)據(jù)庫
mysql5.0以上:多用戶多操作,存在information_schema數(shù)據(jù)庫
information_schema數(shù)據(jù)庫說明:
重要表說明:
1,information_schema.schemata表:此表存放了當前數(shù)據(jù)庫管理系統(tǒng)下所有的數(shù)據(jù)庫,效果等同于show databases;
命令
schema_name列:其包含了當前數(shù)據(jù)庫管理系統(tǒng)中所有的數(shù)據(jù)庫,如上
SQL注入利用:可通過語句:select schema_name from information_schema.schemata;
獲取到當前數(shù)據(jù)庫管理系統(tǒng)中所有的數(shù)據(jù)庫
2,information_schema.tables表: 此表存放了當前數(shù)據(jù)庫管理系統(tǒng)下所有數(shù)據(jù)庫的表,效果等同于所有數(shù)據(jù)庫下show tables
的合集
table_name列:此列記錄當前數(shù)據(jù)庫管理系統(tǒng)中所有表的合集
table_schema列:此列記錄當前數(shù)據(jù)庫管理系統(tǒng)中所有數(shù)據(jù)庫的合集,可通過語句查看:select table_schema from information_schema.tables limit 1,5;
3,information_schema.columns表:此表存放了當前數(shù)據(jù)庫管理系統(tǒng)中所有的列名
table_name列:記錄當前數(shù)據(jù)庫管理系統(tǒng)下表的合集
table_schema列:記錄當前數(shù)據(jù)庫管理系統(tǒng)下數(shù)據(jù)庫名的合集
column_name列:記錄當前數(shù)據(jù)庫管理系統(tǒng)下的所有列的合集
例如:查看數(shù)據(jù)庫名稱為websec下所有的列,語句:select column_name from information_schema.columns where table_schema='websec';
SQL注入利用思路:SQL注入利用information_schema數(shù)據(jù)庫思路(mysql版本高于5.0版本)
1,如果某Web網(wǎng)站存在SQL注入,通過select database()
函數(shù)可以判斷當前數(shù)據(jù)庫,select version()
和select user()
判斷當前數(shù)據(jù)庫版本和當前登陸數(shù)據(jù)庫用戶
2,使用information_schema.table查詢當前數(shù)據(jù)庫包含哪些表,語句:select table_name from information_schema.tables where table_schema='websec';
3,通過步驟2所查表名獲取當前當前表中的列:語句:select column_name from information_schema.columns where table_name='websec';
4,通過所查列名,數(shù)據(jù)表,數(shù)據(jù)庫名獲取當前數(shù)據(jù)庫信息,達到可利用信息的獲取,語句:select * from websec.websec;或select id,name,sex from websec;
如果獲取到的信息包括賬戶和密碼,則可以通過目錄爆破找到后臺登陸頁面,通過SQL注入獲取到的賬戶和密碼登陸網(wǎng)站后臺,然后通過其他手段,例如文件上傳等利用,獲取webshell,拿到Web應用服務器權限。
二:其他常見函數(shù)補充
mysql其他基礎和常見函數(shù)可參考文章:SQL注入—MYSQL基礎語句(持續(xù)更新)附圖
concat(username):將查詢到的username連在一起,默認通過逗號分隔
group_concat(username):將查詢到的username連在一起,默認通過逗號分隔
group_concat(str1,‘?’,‘str2’):將查詢到的內容通過問號分隔開,concat同樣也適用
三:SQL注入常見分類
1,按照注入點類型分類
數(shù)字型
字符型
搜索型
2,按照注入點位置分類
GET
POST
Cookie
HTTP頭部(XFF,User-Agent,REFERER等)
3,按照回顯類型分類
基于事件的盲注
基于布爾類型的盲注
報錯注入
聯(lián)合注入
堆查詢注入(執(zhí)行多條語句的情況下)文章來源:http://www.zghlxwxcb.cn/news/detail-402127.html
參考學習文章:
SQL注入漏洞詳解
SQL注入—MYSQL基礎語句(持續(xù)更新)附圖文章來源地址http://www.zghlxwxcb.cn/news/detail-402127.html
到了這里,關于Web安全—information_schema數(shù)據(jù)庫詳解&基礎補充的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!